Forum Moderators: travelin cat

Message Too Old, No Replies

Netscape 7.02 Feel the earth shake under my feet

css, html button in table run away from cursor

         

jasperx

9:03 pm on Sep 8, 2003 (gmt 0)

10+ Year Member



I built a couple of buttons using a style sheet and some html code... no javascripting involved. They look great and work great in IE and Safari but they got the boogie woogie motion in Netscape 7.02. I don't know if I have an error that Safari and IE are forgiving me OR if this is a "feature" of Netscape 7.02.

Here is the code

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style>
<!--
.buttontext {color: #ffffcc;
text-decoration: none;
font: bold 12pt verdana;
font-style: oblique;
cursor: hand;}

.buttonover {color: #003300;
text-decoration: underline;
font: bold 12pt Verdana;
cursor: hand;}

#logoutbutton {border-style: inset;
border-color: #003300;
background-color: #336633;
width: 150px;
text-align: center;}

#menubutton {border-style: inset;
border-color: #003300;
background-color: #336633;
width: 150px;
text-align: center;}
-->
</style>
<basefont color="#003300">
</head>

<body bgcolor="#003300">
<br><br>
<div align="center">
<table width="700" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
<tr bgcolor="#ffffcc">
<td colspan="5" height="75" valign="middle">
<h1>Kelly Contacts</h1>
</td>
</tr>
</table>
</div>
<div align="center">
<table width="700" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
<tr bgcolor="#ffffcc">
<td height="75" valign="middle"></td>

<td colspan="4" align="center">
<a href="index.php" class="buttontext"
onmouseover="this.className='buttonover';logoutbutton.style.background='#ccff66'"
onmouseout="this.className='buttontext';logoutbutton.style.background='#336633'">
<div id="logoutbutton">
Log Out
</div></a>
</td>
<td colspan="4" align="center">
<a href="menu.php" class="buttontext"
onmouseover="this.className='buttonover';menubutton.style.background='#ccff66'"
onmouseout="this.className='buttontext';menubutton.style.background='#336633'">
<div id="menubutton">
Menu
</div></a>
</td>
<td><br><br></td>
</tr>
</table>
</div>
</body>
</html>

BjarneDM

10:08 am on Sep 11, 2003 (gmt 0)

10+ Year Member



Actually, you *are* using javascript for your buttons, but there's no need at all to use javascript for the solution you are seeking. CSS is quite capable of handling it all by itself :-)

You start by defining a base button:
a.button { }
then you do:
a.button:hover {} , a.button:link {}
etc just like for a normal link, recording the changes in relation to the basic button.

And do get rid of those tables and convert to <div>

You've also got a problem with having <a><div></div></a>
This means you are putting a block-level tag inside an inline tag, which normally isn't a good idea at all. If you need your <a>s to act like block-level tags, set 'display: block;', and to get them on the same line put them in a <div> and furthermore set 'float: left;'

Actually, from the code you have published here, you ought to be able to get rid of the table all together.

For a simple example of what's possible using styled <a>-tags take a look here: [dturunners.mathiesen.info...] . You are welcome to copy and paste as much as you like from there :-)

When you get more advanced, you can even set different background images depending on the button state.

jasperx

2:42 am on Sep 13, 2003 (gmt 0)

10+ Year Member



BjarneDM YOU ARE AN ACE!
The float: left setting for the .buttontext and .buttonover is the change that kept the pesky buttons from running away. I greatly simplified my page.... bascially removed all the content to show the problem. The tables help me manage many colums of information pulled out of a database. I am not quite ready to ditch my tables but do give it consideration from time to time. Old habits die hard but I will look at that link.
I also need to thank you for a previous set of posts and emails in which you were very persistant about helping me with configuring my airport to allow me to serve my site up a cable..... Much of the trouble I was having was with the ISP and magically one day everything started working. Along the way you taught me much.

THANKS!

BjarneDM

6:31 pm on Sep 13, 2003 (gmt 0)

10+ Year Member



*blushes* Thanks for the kind words :-)
Community between hackers is about helping each other out :-)

The link I posted is to a site that works pretty much along the lines such as you have described your project:
-- Apache for the server
-- PHP for serverside scripting
-- MySQL for the database
and everything running under Mac OS X 10.2.6 of course

So, having XHTML, CSS, tables generated from databases, etc. etc. is no problem - just a lot of work and a steep learning curve :-)

I can point you to some *really* good books on the subjects if you are interested.
And I'll also recommend some other software soulitions than the ones that come bundled with Mac OS X.

jasperx

2:12 pm on Sep 15, 2003 (gmt 0)

10+ Year Member



Yes, did visit your site and can see how it is working and with my rusty German and some imagination can almost understand the Danish.

I currently am using a pair of O'Reilly books; Programming PhP and Webdatabase Applications to help with mySQL and PHP and my references for html and javascript are Goodman's Dynamic HTML and Javascript Bible. Beyond that I mainly use plenty of searches and an occasional post.... What is missing is probably a good css reference.

BjarneDM

3:07 pm on Sep 15, 2003 (gmt 0)

10+ Year Member



I'll recommend the following:
[sitepoint.com...]
[safari.oreilly.com...]
[safari.oreilly.com...]

My site: Of course, what you can't see is the server-side php-programming. Please feel free to ask if there's any particular point on the site you'd like an explanation on how was achieved.

I'll also recommend switching to Apache 2.0.47, PHP and MySQL from [serverlogistics.com...] if you don't already use them :-)