Sun, 2005-05-22 14:41
Hello,
I have a problem with my css menu, it doesn't look like on IE as well as on FireFox
I've searched during several hours and I don't understand why it doesn't work
The problem is the width of my menu and its representation by IE : I want my menu to be 100% width of the body which have a margin of 2%, so I fix 96% for the <div> menu, it works very well on Mozilla but not on IE !
I've arrived to correct on IE with a table, but after this modification it doesn't work on Mozilla !
Please help me !
My menu :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script language="JavaScript"> <!-- function SymError() { return true; } window.onerror = SymError; //--> </script> <script type="text/javascript"> <!-- window.onload=show; function show(id) { var d = document.getElementById(id); for (var i = 1; i<=10; i++) { if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';} } if (d) {d.style.display='block';} } //--> </script> <style type="text/css"> <!-- body { margin: 2%; padding: 0; background: white; font: 80% verdana, arial, sans-serif; } dl, dt, dd, ul, li { margin: 0; padding: 0; list-style-type: none; } #menu { position: absolute; top: 0; z-index:100; width: 100%; } #menu dl { float: left; width: 20%; } #menu dt { cursor: pointer; text-align: center; font-weight: bold; background: #ccc; border: 1px solid gray; } #menu dd { display: none; border: 1px solid gray; margin: 0 1px; } #menu li { text-align: center; background: #fff; } #menu li a, #menu dt a { color: #000; text-decoration: none; display: block; height: 100%; border: 0 none; } #menu li a:hover, #menu li a:focus, #menu dt a:hover, #menu dt a:focus { background: #eee; } --> </style> </head> <body> <div id="menu"> <dl> <dt onmouseover="javascript:show();"><a href="">Home</a></dt> </dl> <dl> <dt onmouseover="javascript:show('smenu1');">Menu 1</dt> <dd id="smenu1"> <ul> <li><a href="#">1.1</a></li> <li><a href="#">1.2</a></li> <li><a href="#">1.3</a></li> <li><a href="#">1.4</a></li> <li><a href="#">1.5</a></li> <li><a href="#">1.6</a></li> </ul> </dd> </dl> <dl> <dt onmouseover="javascript:show();"><a href="">Menu 2</a></dt> </dl> <dl> <dt onmouseover="javascript:show('smenu3');">Menu 3</dt> <dd id="smenu3"> <ul> <li><a href="#">3.1</a></li> <li><a href="#">3.2</a></li> <li><a href="#">3.3</a></li> <li><a href="#">3.4</a></li> <li><a href="#">3.5</a></li> </ul> </dd> </dl> <dl> <dt onmouseover="javascript:show('smenu4');">Menu 4</dt> <dd id="smenu4"> <ul> <li><a href="#">4.1</a></li> <li><a href="#">4.2</a></li> <li><a href="#">4.3</a></li> </ul> </dd> </dl> </div> </body> </html>
Thanks you,
regards
PS : exuse me for my very bad english