Forum Moderators: open
Alright I am trying to create a drop down menu for my site. I am still working on it and long way from being done. And I need some help. Here is the test menu link:
<Sorry, no personal URLs. See TOS [webmasterworld.com]>
1. I don't know why there is a gap when I open the page in IE.
2. How can I change the color of my link when the mouse is moving over that cell?
3. Any idea why the menu is not aligned the same as it is in Netscape?
Thanks beforehand
[edited by: tedster at 3:06 am (utc) on July 29, 2004]
First thing I always make sure of before I work to debug cross-browser issues is that I have valid markup - both HTML [validator.w3.org] and CSS [jigsaw.w3.org].
Once I know that, I check into Quirks Mode vs. Standards Mode [webmasterworld.com] issues.
And finally, check out this cross browser DHTML menu system [webmasterworld.com] written and refined by our own BlobFisk. It comes with a nice tutorial that may give you some ideas - and the mark-up is about as efficient and cross browser compatible as I've ever seen.
------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Website Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<meta name="keywords" content="keywords list">
<script language="JavaScript" type="text/javascript">
<!--
var statusbarmessage="Welcome to this website";
function status_bar()
{
window.status = statusbarmessage;
}
-->
</script>
<link rel="stylesheet" href="rona.css">
<!--Code used for onmouseover and onmouseout-->
<script language="JavaScript" type="text/javascript">
<!--
menu1on = new Image();
menu1on.src = "images/home_on.gif";
menu2on = new Image();
menu2on.src = "images/history_on.gif";
menu3on = new Image();
menu3on.src = "images/about_us_on.gif";
menu4on = new Image();
menu4on.src = "images/links_on.gif";
menu5on = new Image();
menu5on.src = "images/pictures_on.gif";
menu6on = new Image();
menu6on.src = "images/join_on.gif";
menu7on = new Image();
menu7on.src = "images/contact_us_on.gif";
//-->
</script>
</head>
<body onLoad="status_bar()" background="images/sandstone.gif" bgcolor=white text=black link="#FF2E47" alink="#FF2E47" vlink="#FF2E47">
<center>
<font face="Verdana, Arial, Helvetica, sans-serif">
<img src="images/title.gif" alt="title">
<br><br>
<table align="center" width="800" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width=35>
</td>
<td width=100 align=center >
<a href="english_index.html"><img name="myImg1" src="images/home.gif" border="0"></a>
</td>
<td width=5>
</td>
<td width=100 align=center onMouseOver="myImg2.src=menu2on.src;" onMouseOut="myImg2.src='images/history_off.gif';">
<a href="history.html"><img name="myImg2" src="images/history_off.gif" border="0"></a>
</td>
<td width=5>
</td>
<td width=100 align=center onMouseOver="myImg3.src=menu3on.src;" onMouseOut="myImg3.src='images/about_us_off.gif';">
<a href="about_us.html"><img name="myImg3" src="images/about_us_off.gif" border="0"></a>
</td>
<td width=5>
</td>
<td width=100 align=center onMouseOver="myImg4.src=menu4on.src;" onMouseOut="myImg4.src='images/links_off.gif';">
<a href="links1.html"><img name="myImg4" src="images/links_off.gif" border="0"></a>
</td>
</td>
<td width=5>
</td>
<td width=100 align=center onMouseOver="myImg5.src=menu5on.src;" onMouseOut="myImg5.src='images/pictures_off.gif';">
<a href="pictures1.html"><img name="myImg5" src="images/pictures_off.gif" border="0"></a>
</td>
</td>
<td width=5>
</td>
<td width=100 align=center onMouseOver="myImg6.src=menu6on.src;" onMouseOut="myImg6.src='images/join_off.gif';">
<a href="join.html"><img name="myImg6" src="images/join_off.gif" border="0"></a>
</td>
<td width=5>
</td>
<td width=100 align=center onMouseOver="myImg7.src=menu7on.src;" onMouseOut="myImg7.src='images/contact_us_off.gif';">
<a href="contact_us.html"><img name="myImg7" src="images/contact_us_off.gif" border="0"></a>
</td>
<td width=35>
</td>
</tr>
</table>
<table align="center" width="800" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width=800><img src="images/line1.gif"></td>
</tr>
</table>
<br>
<br>
<br>
<font color=black size="1">Copyright © 2003-2004, All Rights Reserved.</font>
<br>
</font>
</center>
</body>
</html>
[edited by: tedster at 11:29 pm (utc) on July 29, 2004]
[edit reason] remove specifics [/edit]
There's lots of help freely available from the large membership here - but please help us first. Boil down your problem to a specific section of code that is the minimum needed to reproduce the problem. See Posting Code [webmasterworld.com] for more information.
------------------
<table align="center" width="800" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width=35></td>
<td width=100 align=center >
<a href="english_index.html"><img name="myImg1" src="images/home.gif" border="0"></a>
</td>
<td width=5></td>
<td width=100 align=center onMouseOver="myImg2.src=menu2on.src;" onMouseOut="myImg2.src='images/history_off.gif';">
<a href="history.html"><img name="myImg2" src="images/history_off.gif" border="0"></a>
</td>
<td width=5></td>
<td width=100 align=center onMouseOver="myImg3.src=menu3on.src;" onMouseOut="myImg3.src='images/about_us_off.gif';">
<a href="about_us.html"><img name="myImg3" src="images/about_us_off.gif" border="0"></a>
</td>
<td width=5></td>
<td width=100 align=center onMouseOver="myImg4.src=menu4on.src;" onMouseOut="myImg4.src='images/links_off.gif';">
<a href="links1.html"><img name="myImg4" src="images/links_off.gif" border="0"></a>
</td>
<td width=5></td>
<td width=100 align=center onMouseOver="myImg5.src=menu5on.src;" onMouseOut="myImg5.src='images/pictures_off.gif';">
<a href="pictures1.html"><img name="myImg5" src="images/pictures_off.gif" border="0"></a>
</td>
<td width=5></td>
<td width=100 align=center onMouseOver="myImg6.src=menu6on.src;" onMouseOut="myImg6.src='images/join_off.gif';">
<a href="join.html"><img name="myImg6" src="images/join_off.gif" border="0"></a>
</td>
<td width=5></td>
<td width=100 align=center onMouseOver="myImg7.src=menu7on.src;" onMouseOut="myImg7.src='images/contact_us_off.gif';">
<a href="contact_us.html"><img name="myImg7" src="images/contact_us_off.gif" border="0"></a>
</td>
<td width=35></td>
</tr>
</table>
<table align="center" width="800" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width=800><img src="images/line1.gif"></td>
</tr>
</table>
1. You have set the table to 800px wide
2. The code you posted does not have width or height for images - so I can't tell for sure, but do those widths add up to exactly 800 px? If not, there must be some side gaps in order that the table actually take up 800px in width.
3. You are using a full DTD, so modern browsers will be rendering in standards mode, not quirks mode. This as implications for how images should be displayed, and its especially noticable inside a table cell.
See Quirks Mode vs. Standards Mode [webmasterworld.com] for details, but know that an image is displayed as INLINE element item by default, not a block element. So the standards say the image should align with the text baseline - and that leaves a gap so that there is space for the descenders in any text.
Even if there is no text in the cell, modern browsers in standards mode leave space for that possibility. Quirks mode never acted this way, so it can be startling.
Do a quick experiment on your test page and change your DTD to this, by removing the URL for the W3C:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">
You are using a full DTD, so modern browsers will be rendering in standards mode, not quirks mode. This as implications for how images should be displayed, and its especially noticable inside a table cell.
I thought though that quirk mode should be avoided or should it? Won't that cause a possible "break" in the design for other browsers?
Just curious.
Take care,
Brian
I thought though that quirk mode should be avoided or should it?
Layout that is based on quirks mode rendering needs to be addressed if, through your DTD, you ask the modern browsers to render in standards mode. It's an awkward transitional moment that will last at least a few more years. In some cases, you may want to ensure quirks mode rather than avoid it.
But most of all, if you are authoring web documents you need to learn what the standards are and use them wisely so your mark-up loooks good on older browsers AND modern browsers. Right now, the easiest path is to ENSURE quirks mode - but IMO that's not the wisest. Web authoring is an area where your education needs to continue almost daily and standards mode rendering is a current area that needs attention.
Your content in each cell of the tables needs to butt up against the starting td and ending td. So this:
<td width=100 align=center onMouseOver="myImg2.src=menu2on.src;" onMouseOut="myImg2.src='images/history_off.gif';">
<a href="history.html"><img name="myImg2" src="images/history_off.gif" border="0"></a>
</td>
needs to be this:
<td width=100 align=center onMouseOver="myImg2.src=menu2on.src;" onMouseOut="myImg2.src='images/history_off.gif';"><a href="history.html"><img name="myImg2" src="images/history_off.gif" border="0"></a></td>
I just tried it out and the bottom image went flush againts the top row of images. Good luck. :)
So it's not Quirks/Standards at all, in this case. But please, don't let that stop you from learning about it!