thomasp
23 Aug 2008, 19:20
The person I'm designing a website for (see previous threads :p) has started sending me content for the site, so I can finally get on with changing it! Anyway, I've been trying to get a nice rollover menu (submenu pops out on mouseover) for the navigation bar, similar to this one: http://css.maxdesign.com.au/listamatic2/vertical11.htm - but as I'm sure you can guess from the title of this thread, it's not working as intended in IE7 (screw IE6, that'll be too much hassle :p), it works fine in Safari 3, Firefox 3, Camino and Opera (Opera's a little weird, but it still works)
Basically, I'm being told by the site's owner, who unfortunately uses IE7, that the pop-down menu isn't appearing. The entire CSS and HTML code is included below, with a few things cut out so you lot can't go emailing them and saying how incompetent their website designer is :p Basically what seems to happen in IE7 is that the main menu options get shifted over to the left, partly outside the blue frame (bar the "Site Map", which is not part of the main list), and the submenus quite stubbornly refuse to appear. None of this occurs in proper web browsers. Also, IE adds too much line spacing.
I've had to pad the main paragraphs out a bit in case you wish to see how that renders on your own computer, since the layout seems to get screwed up with very short paragraphs - hope there's enough Lorem Ipsum in there!
Thanks :D
HTML code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="styles.css" type="text/css">
<title>Welcome to the site</title>
</head>
<body>
<!-- Page wrapper to generate white centre background -->
<div id="wrapper">
<a name="#top">
<!-- Main logo -->
<div id="logo">
<img src="images/logo.png" alt="logo">
</div>
<!-- End logo -->
<!-- Green banner beneath logo -->
<div id="greenbanner">
<img src="images/green_banner.png" width="900px" height="35px" alt="Green banner">
</div>
<!-- End green banner -->
<!-- Container for main portion of page -->
<div id="container">
<!-- Navbox -->
<div id="navbox">
<p class="navheader">Navigation</p>
<ul id="navlist">
<!-- Active link -->
<li><span class="navboxtextactive">Home</span></li>
<!-- End Active Link -->
<li id="active"><a href="pages/company.html" id="current">Our Company</a>
<!-- submenu popout -->
<ul id="subnavlist">
<li id="subactive"><a href="pages/company/ethos.html" id="subcurrent">Ethos & Values</a></li>
<li id="subactive"><a href="pages/company/code_of_conduct.html" id="subcurrent">Code of Conduct</a></li>
<li id="subactive"><a href="pages/company/terms.html" id="subcurrent">Terms & Conditions</a></li>
</ul>
</li>
<!-- end submenu -->
<li id="active"><a href="pages/portfolio.html">Training & Development Portfolio</a>
<!-- submenu popout -->
<ul id="subnavlist">
<li id="subactive"><a href="pages/portfolio/schools_student.html" id="subcurrent">Schools/colleges - student focused</a></li>
<li id="subactive"><a href="pages/portfolio/schools_general.html" id="subcurrent">Schools/colleges - general</a></li>
<li id="subactive"><a href="pages/portfolio/business_industry.html" id="subcurrent">Business/Industry</a></li>
<li id="subactive"><a href="pages/portfolio/consultancy_services.html" id="subcurrent">Consultancy Services</a></li>
</ul>
</li>
<!-- end submenu -->
<li><a href="pages/programmes.html">New Programmes for 2008/09</a></li>
<li id="active"><a href="pages/resources.html">Resource Library</a>
<!-- submenu popout -->
<ul id="subnavlist">
<li id="subactive"><a href="pages/resources/tips.html" id="subcurrent">Top Tips</a></li>
<li id="subactive"><a href="pages/resources/factsheets.html" id="subcurrent">Factsheets</a></li>
<li id="subactive"><a href="pages/resources/useful_sites.html" id="subcurrent">Useful Websites</a></li>
<li id="subactive"><a href="pages/resources/newsletters.html" id="subcurrent">Newsletter Library</a></li>
</ul>
</li>
<!-- end submenu -->
<li><a href="pages/contact.html">Contact Us</a></li>
</ul>
<p class="navboxtext">
<a href="pages/sitemap.html">Site Map</a></p>
</div>
<!-- End navbox -->
<!-- Main body -->
<div id="main">
<p class="pagetitle">Welcome</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras quis orci. Etiam sem ligula, lacinia vel, consequat porta, viverra sed, metus. Suspendisse vestibulum pede sed diam. Curabitur ultricies venenatis metus. Mauris scelerisque ipsum hendrerit dui. Ut libero velit, congue vel, laoreet ac, euismod nec, turpis. Aenean mollis ipsum eget quam. Integer iaculis, augue eu rutrum rhoncus, odio nibh luctus urna, et dapibus metus urna nec dolor. Nunc vulputate dignissim nibh. Sed blandit. Etiam ante tortor, interdum vel, rhoncus eget, interdum ut, orci. Donec ut arcu a mauris dapibus consectetuer. Phasellus semper neque eu ipsum. Phasellus vitae mauris. Aenean dui. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi sit amet lectus. Praesent arcu. Nunc id turpis vel eros eleifend elementum.</p>
<p>Donec ultricies nulla id velit venenatis aliquam. Nam ut justo ac velit vestibulum tincidunt. Suspendisse mollis leo. Nam ultrices magna eget diam. Etiam velit risus, laoreet vel, lacinia id, commodo a, leo. Etiam molestie tempus enim. Integer dignissim bibendum metus. Maecenas ac risus non nunc egestas tempor. Mauris imperdiet tempus ligula. Etiam sit amet enim. Fusce metus nibh, aliquam eget, posuere quis, lacinia sit amet, sem. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec a urna eget est fermentum semper. Maecenas ultricies eros quis lorem.omes.</p>
<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi sapien sapien, convallis eget, posuere eget, tempor pellentesque, nisl. Praesent bibendum tincidunt nulla. Nulla nulla diam, condimentum sed, interdum at, consectetuer nec, leo. Sed eget ligula. Donec auctor. In hac habitasse platea dictumst. Vestibulum vel pede vel lectus imperdiet venenatis. In euismod tellus id enim. Suspendisse ante risus, ullamcorper vitae, congue sit amet, commodo nec, libero. Morbi libero. Mauris justo.</p>
<p>Praesent consectetuer laoreet sem. Morbi libero diam, consequat sit amet, mollis quis, dapibus nec, risus. Aliquam eu pede. Donec nunc dolor, luctus vel, consequat id, ultrices at, tellus. Etiam ac massa. Duis eros. Aenean id nunc nec sapien mollis iaculis. Maecenas vestibulum, sapien nec lacinia posuere, urna urna condimentum lacus, a interdum lorem orci non pede. Aenean blandit fermentum tortor. Donec tempor egestas orci. Sed rutrum velit. Pellentesque auctor dictum nisl. Aliquam erat volutpat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Phasellus bibendum scelerisque nisl. Sed non massa.
</p>
<p>You can register to receive our newsletters and updates on forthcoming events via e-mail by clicking <a href="pages/contact.html">here.</a></p>
<!-- Return to top link -->
<p class="returntotop">
<br><br>
<a href="#top">Return to top</a>
</p>
<!-- End Return to top -->
</div>
<!-- End main body -->
<!-- End container -->
</div>
<!-- End wrapper -->
</div>
<!-- Copyright -->
<div id="copyright">
<p>
Copyright © 2008.
</p>
</div>
<!-- End Copyright -->
</body>
</html>
CSS code:
body
{
background-color:#D9E7FF;
margin:0px;
padding:0px;
text-align:center;
}
/* Main body "boxes" */
#wrapper
{
margin-top:50px;
margin-left:auto;
margin-right:auto;
margin-bottom:0px;
text-align:left;
width: 900px;
background-color:white;
}
#logo
{
margin-top:5px;
margin-bottom:5px;
}
#greenbanner
{
margin-bottom:3px;
}
#container
{
background:#ffffff url('images/navbg.gif') top left repeat-y;
}
#navbox
{
float:left;
text-align:left;
width:205px;
height:auto;
margin-bottom:0px;
padding-left:20px;
padding-top:6px;
}
/* Main page text */
#main
{
text-align:left;
background-color:white;
width:610px;
height:auto;
padding-left:20px;
padding-right:45px;
padding-top:1px;
padding-bottom:20px;
margin-left:225px;
font-family:'Trebuchet MS', 'Arial';
color:black;
font-size:10pt;
}
/* Regularly-used fonts */
.pagetitle
{
font-family:'Trebuchet MS', 'Arial';
color:black;
font-weight:700;
font-size:18pt;
}
#copyright
{
font-family:'Trebuchet MS', 'Arial';
font-size:8pt;
color:black;
margin-top:0px;
margin-left:auto;
margin-right:auto;
text-align:left;
width:900px;
}
.returntotop
{
font-family:'Trebuchet MS', 'Arial';
font-size:8pt;
font-style:italic;
color:black;
}
/* Navbox fonts */
#navlist
{
list-style-type:none;
font-family:'Trebuchet MS', 'Arial';
color:white;
font-size:12pt;
font-weight:700;
margin-left:-40px;
}
#navlist li
{
margin-bottom:6pt;
}
#subnavlist
{
list-style-type:none;
font-family:'Trebuchet MS', 'Arial';
color:white;
font-size:10pt;
font-weight:700;
margin-left:-25px;
}
#subnavlist li
{
margin-bottom:3pt;
}
#subnavlist li
{
margin-bottom: 2pt;
}
#active:hover li
{
display:block;
}
#active li
{
display:none;
}
#navbox A
{
text-decoration:none;
display:block;
}
#navbox A:link
{
color:white;
}
#navbox A:visited
{
color:#DEDEDE;
}
#navbox A:hover
{
color:black;
}
#navbox A:active
{
color:black;
}
.navboxtext
{
font-family:'Trebuchet MS', 'Arial';
color:white;
font-size:12pt;
font-weight:700;
}
.navboxtext A
{
text-decoration:none;
display:block;
}
.navboxtext A:link
{
color:white;
}
.navboxtext A:visited
{
color:#DEDEDE;
}
.navboxtext A:hover
{
color:black;
}
.navboxtext A:active
{
color:black;
}
.navheader
{
font-family:'Trebuchet MS', 'Arial';
color:white;
font-size:16pt;
font-weight:700;
}
.navboxtextactive
{
font-family:'Trebuchet MS', 'Arial';
color:black;
font-size:12pt;
font-weight:700;
}
.navboxtextactivesmall
{
font-family:'Trebuchet MS', 'Arial';
color:black;
font-size:10pt;
font-weight:700;
}
Basically, I'm being told by the site's owner, who unfortunately uses IE7, that the pop-down menu isn't appearing. The entire CSS and HTML code is included below, with a few things cut out so you lot can't go emailing them and saying how incompetent their website designer is :p Basically what seems to happen in IE7 is that the main menu options get shifted over to the left, partly outside the blue frame (bar the "Site Map", which is not part of the main list), and the submenus quite stubbornly refuse to appear. None of this occurs in proper web browsers. Also, IE adds too much line spacing.
I've had to pad the main paragraphs out a bit in case you wish to see how that renders on your own computer, since the layout seems to get screwed up with very short paragraphs - hope there's enough Lorem Ipsum in there!
Thanks :D
HTML code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="styles.css" type="text/css">
<title>Welcome to the site</title>
</head>
<body>
<!-- Page wrapper to generate white centre background -->
<div id="wrapper">
<a name="#top">
<!-- Main logo -->
<div id="logo">
<img src="images/logo.png" alt="logo">
</div>
<!-- End logo -->
<!-- Green banner beneath logo -->
<div id="greenbanner">
<img src="images/green_banner.png" width="900px" height="35px" alt="Green banner">
</div>
<!-- End green banner -->
<!-- Container for main portion of page -->
<div id="container">
<!-- Navbox -->
<div id="navbox">
<p class="navheader">Navigation</p>
<ul id="navlist">
<!-- Active link -->
<li><span class="navboxtextactive">Home</span></li>
<!-- End Active Link -->
<li id="active"><a href="pages/company.html" id="current">Our Company</a>
<!-- submenu popout -->
<ul id="subnavlist">
<li id="subactive"><a href="pages/company/ethos.html" id="subcurrent">Ethos & Values</a></li>
<li id="subactive"><a href="pages/company/code_of_conduct.html" id="subcurrent">Code of Conduct</a></li>
<li id="subactive"><a href="pages/company/terms.html" id="subcurrent">Terms & Conditions</a></li>
</ul>
</li>
<!-- end submenu -->
<li id="active"><a href="pages/portfolio.html">Training & Development Portfolio</a>
<!-- submenu popout -->
<ul id="subnavlist">
<li id="subactive"><a href="pages/portfolio/schools_student.html" id="subcurrent">Schools/colleges - student focused</a></li>
<li id="subactive"><a href="pages/portfolio/schools_general.html" id="subcurrent">Schools/colleges - general</a></li>
<li id="subactive"><a href="pages/portfolio/business_industry.html" id="subcurrent">Business/Industry</a></li>
<li id="subactive"><a href="pages/portfolio/consultancy_services.html" id="subcurrent">Consultancy Services</a></li>
</ul>
</li>
<!-- end submenu -->
<li><a href="pages/programmes.html">New Programmes for 2008/09</a></li>
<li id="active"><a href="pages/resources.html">Resource Library</a>
<!-- submenu popout -->
<ul id="subnavlist">
<li id="subactive"><a href="pages/resources/tips.html" id="subcurrent">Top Tips</a></li>
<li id="subactive"><a href="pages/resources/factsheets.html" id="subcurrent">Factsheets</a></li>
<li id="subactive"><a href="pages/resources/useful_sites.html" id="subcurrent">Useful Websites</a></li>
<li id="subactive"><a href="pages/resources/newsletters.html" id="subcurrent">Newsletter Library</a></li>
</ul>
</li>
<!-- end submenu -->
<li><a href="pages/contact.html">Contact Us</a></li>
</ul>
<p class="navboxtext">
<a href="pages/sitemap.html">Site Map</a></p>
</div>
<!-- End navbox -->
<!-- Main body -->
<div id="main">
<p class="pagetitle">Welcome</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras quis orci. Etiam sem ligula, lacinia vel, consequat porta, viverra sed, metus. Suspendisse vestibulum pede sed diam. Curabitur ultricies venenatis metus. Mauris scelerisque ipsum hendrerit dui. Ut libero velit, congue vel, laoreet ac, euismod nec, turpis. Aenean mollis ipsum eget quam. Integer iaculis, augue eu rutrum rhoncus, odio nibh luctus urna, et dapibus metus urna nec dolor. Nunc vulputate dignissim nibh. Sed blandit. Etiam ante tortor, interdum vel, rhoncus eget, interdum ut, orci. Donec ut arcu a mauris dapibus consectetuer. Phasellus semper neque eu ipsum. Phasellus vitae mauris. Aenean dui. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi sit amet lectus. Praesent arcu. Nunc id turpis vel eros eleifend elementum.</p>
<p>Donec ultricies nulla id velit venenatis aliquam. Nam ut justo ac velit vestibulum tincidunt. Suspendisse mollis leo. Nam ultrices magna eget diam. Etiam velit risus, laoreet vel, lacinia id, commodo a, leo. Etiam molestie tempus enim. Integer dignissim bibendum metus. Maecenas ac risus non nunc egestas tempor. Mauris imperdiet tempus ligula. Etiam sit amet enim. Fusce metus nibh, aliquam eget, posuere quis, lacinia sit amet, sem. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec a urna eget est fermentum semper. Maecenas ultricies eros quis lorem.omes.</p>
<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi sapien sapien, convallis eget, posuere eget, tempor pellentesque, nisl. Praesent bibendum tincidunt nulla. Nulla nulla diam, condimentum sed, interdum at, consectetuer nec, leo. Sed eget ligula. Donec auctor. In hac habitasse platea dictumst. Vestibulum vel pede vel lectus imperdiet venenatis. In euismod tellus id enim. Suspendisse ante risus, ullamcorper vitae, congue sit amet, commodo nec, libero. Morbi libero. Mauris justo.</p>
<p>Praesent consectetuer laoreet sem. Morbi libero diam, consequat sit amet, mollis quis, dapibus nec, risus. Aliquam eu pede. Donec nunc dolor, luctus vel, consequat id, ultrices at, tellus. Etiam ac massa. Duis eros. Aenean id nunc nec sapien mollis iaculis. Maecenas vestibulum, sapien nec lacinia posuere, urna urna condimentum lacus, a interdum lorem orci non pede. Aenean blandit fermentum tortor. Donec tempor egestas orci. Sed rutrum velit. Pellentesque auctor dictum nisl. Aliquam erat volutpat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Phasellus bibendum scelerisque nisl. Sed non massa.
</p>
<p>You can register to receive our newsletters and updates on forthcoming events via e-mail by clicking <a href="pages/contact.html">here.</a></p>
<!-- Return to top link -->
<p class="returntotop">
<br><br>
<a href="#top">Return to top</a>
</p>
<!-- End Return to top -->
</div>
<!-- End main body -->
<!-- End container -->
</div>
<!-- End wrapper -->
</div>
<!-- Copyright -->
<div id="copyright">
<p>
Copyright © 2008.
</p>
</div>
<!-- End Copyright -->
</body>
</html>
CSS code:
body
{
background-color:#D9E7FF;
margin:0px;
padding:0px;
text-align:center;
}
/* Main body "boxes" */
#wrapper
{
margin-top:50px;
margin-left:auto;
margin-right:auto;
margin-bottom:0px;
text-align:left;
width: 900px;
background-color:white;
}
#logo
{
margin-top:5px;
margin-bottom:5px;
}
#greenbanner
{
margin-bottom:3px;
}
#container
{
background:#ffffff url('images/navbg.gif') top left repeat-y;
}
#navbox
{
float:left;
text-align:left;
width:205px;
height:auto;
margin-bottom:0px;
padding-left:20px;
padding-top:6px;
}
/* Main page text */
#main
{
text-align:left;
background-color:white;
width:610px;
height:auto;
padding-left:20px;
padding-right:45px;
padding-top:1px;
padding-bottom:20px;
margin-left:225px;
font-family:'Trebuchet MS', 'Arial';
color:black;
font-size:10pt;
}
/* Regularly-used fonts */
.pagetitle
{
font-family:'Trebuchet MS', 'Arial';
color:black;
font-weight:700;
font-size:18pt;
}
#copyright
{
font-family:'Trebuchet MS', 'Arial';
font-size:8pt;
color:black;
margin-top:0px;
margin-left:auto;
margin-right:auto;
text-align:left;
width:900px;
}
.returntotop
{
font-family:'Trebuchet MS', 'Arial';
font-size:8pt;
font-style:italic;
color:black;
}
/* Navbox fonts */
#navlist
{
list-style-type:none;
font-family:'Trebuchet MS', 'Arial';
color:white;
font-size:12pt;
font-weight:700;
margin-left:-40px;
}
#navlist li
{
margin-bottom:6pt;
}
#subnavlist
{
list-style-type:none;
font-family:'Trebuchet MS', 'Arial';
color:white;
font-size:10pt;
font-weight:700;
margin-left:-25px;
}
#subnavlist li
{
margin-bottom:3pt;
}
#subnavlist li
{
margin-bottom: 2pt;
}
#active:hover li
{
display:block;
}
#active li
{
display:none;
}
#navbox A
{
text-decoration:none;
display:block;
}
#navbox A:link
{
color:white;
}
#navbox A:visited
{
color:#DEDEDE;
}
#navbox A:hover
{
color:black;
}
#navbox A:active
{
color:black;
}
.navboxtext
{
font-family:'Trebuchet MS', 'Arial';
color:white;
font-size:12pt;
font-weight:700;
}
.navboxtext A
{
text-decoration:none;
display:block;
}
.navboxtext A:link
{
color:white;
}
.navboxtext A:visited
{
color:#DEDEDE;
}
.navboxtext A:hover
{
color:black;
}
.navboxtext A:active
{
color:black;
}
.navheader
{
font-family:'Trebuchet MS', 'Arial';
color:white;
font-size:16pt;
font-weight:700;
}
.navboxtextactive
{
font-family:'Trebuchet MS', 'Arial';
color:black;
font-size:12pt;
font-weight:700;
}
.navboxtextactivesmall
{
font-family:'Trebuchet MS', 'Arial';
color:black;
font-size:10pt;
font-weight:700;
}