Doc type effects menu offset in IE - driving me nuts!

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
wilydunk
Beginner
Beginner
Posts: 2
Joined: Sun Feb 26, 2006 11:06 pm

Doc type effects menu offset in IE - driving me nuts!

Post by wilydunk »

Using the following doc type causes IE to have a weird offset (circa 18 pixles underneath the link) on the most simple of code:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>

</head>

<body >


<SCRIPT language=JavaScript src="./menus/milonic_src.js" type=text/javascript></SCRIPT>
<script language=JavaScript>
if(parent.frames.length){top.location=document.location}
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=./menus/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=./menus/mmenudom.js><\/scr"+"ipt>");
</script>


<img src="./i/placer.gif" id="tester" /><a href="#" onmouseover="popup('test','tester')" onmouseout="popdown()">TEST</a>

<script>

with(dropdownstyle=new mm_style()){
bordercolor="#5b6f7b";borderwidth="1";
borderstyle="solid";
}

with(milonic=new menuname("test")){
style=dropdownstyle;
aI("text=tester;url=software.asp?pg=57;showmenu=tester;");
}


drawMenus()</script>



</body>
</html>



Removing the doc type solves the problem (but creates others) and I WANT that doc type for the site.

Are they any know 'issues' or work arounds?
Migru
Milonic Guru
Milonic Guru
Posts: 669
Joined: Tue Nov 01, 2005 8:22 pm
Location: Hamburg - Germany
Contact:

Post by Migru »

Hi

don´t know if a doctype setting is doing standardizing margin settings, which normally should be accomplished in the head section by style or reference to css containing the style .

Michael

something like

Code: Select all

<link href="yourfilename.css" rel="stylesheet" media="screen">
and in the yourfilename.css file (with some other styles) that one (simplest )

Code: Select all

body { margin: 0px }
hope that helps
vikenk
Mega Advanced
Mega Advanced
Posts: 297
Joined: Tue Nov 29, 2005 7:38 pm

Post by vikenk »

Hi,

Does the use of the doctype affect Firefox/Netscape/Opera? Using a doctype forces IE to "standards-compliant" mode, where it would normally be in "quirks" mode. Standards Compliant mode in IE really affects what's called the "box-model", and things you designed before adding a doctype may look different.

If you designed this site for IE then added the doctype afterwards, then I can see why you are having this problem. Try looking in your css file (if you have one) for any styles affecting tables, <td>, or <body> margins, padding, or sizing.

The code you supplied in your post isn't quite enough to make a proper diagnosis. If you could supply a url to the problem site or a url to your css sheet, that would be helpful.
wilydunk
Beginner
Beginner
Posts: 2
Joined: Sun Feb 26, 2006 11:06 pm

Post by wilydunk »

Thank you!!! Great stuff - I'm not sure what the doc type does to the margins in IE but setting it all to zero on the body works a treat.

The site is designed to do cross browser - and in Opera/Netscape/FF all worked fine. Annoyingly on my live site the body DOES have the margin set - but not to zero - and this still causes the problem. Making it zero and setting the margins on a "wrapper" class around the content does the job though.

Cheers!
Migru
Milonic Guru
Milonic Guru
Posts: 669
Joined: Tue Nov 01, 2005 8:22 pm
Location: Hamburg - Germany
Contact:

Post by Migru »

Hi

these reflections on "box model" bug etc. I don´t think that they are, at this point applicable. The margin settings, which you find on/at practically all page settings of websites are simply necessary to standardize the zero point, as the browsers start counting pixels different. (As far as I´m informed). So the margins may be set individually (top,left,bottom,right) or just as it is in this case, to zero (or any other reasonable value) for all four.

If I find it, will provide a link on this

Michael
Post Reply