Cross-Browser Problem with Overflow Hidden Preventing Menu Expansion

I enclose a horizontal javascript menu in a couple of divs to center them in a fluid layout.

I can get FF3 and IE7 to display the same way, with the use of overflow = hidden in the outermost div containing the menu (in this case div id="naverbarwrap") but overflow= hidden prevents the menu item from expanding vertically downwards.

Removing overflow= hidden fixes the menu expansion problem in both IE7 and FF3 and doesn't affect the page layout in IE7 but it breaks the layout in FF3.

Code and illustrative screengrabs in both IE7 and FF3 are attached.  The missing Javascript files and CSS are stock files from Dreamveaver CS3.

Is there a way to fix this in CSS without resorting to a conditional stylesheet being loaded in the html?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<link href="CSS/global_reset_meyer.css" rel="stylesheet" type="text/css" />
/*import oneColElsCtr.css*/
body {
	font: 100% Verdana, Arial, Helvetica, sans-serif;
	background: #666666;
	margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
	padding: 0;
	text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
	color: #000000;
#container {
	/*	width: 46em;*/
 	width: 55em; /*update the container width set in oneColElsCtr.css by changing width=43em to width =55em*/
	background: #FFFFFF;
	margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
	border: 1px solid #000000;
	text-align: left; /* this overrides the text-align: center on the body element. */
#mainContent {
	padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
/* Heading */
h1, h2, h3, h4, h5, h6 {
h1 {
	font-size: 180%;
	font-weight: bold;
h2 {
	font-size: 150%;
	font-weight: bold;
h3 {
	font-size: 125%;
	font-weight: bold;
h4 {
	font-size: 100%;
/*set two wrapping divs for menu so it can be centered using left and right rules in successive divs (per EE replies)*/
#navbarwrap {
	position: relative;
	/*	margin: 0 auto;*/
	margin: 0 auto;
	width: 100%;
	height: auto;
	/*	height: 40px;*/
	overflow: hidden;
#navbar {
	position: relative;
	float: left;
	left: 50%;
	margin: 0;
	padding: 0;/*	margin: 0 auto;*/
/*	overflow: hidden;*/
/*	width: 100%*/
#navbarinner {
	position: relative;
	right: 50%;
#header {
	margin: 0;
	padding: 0;
	background-color: #99CC33;
#leftcolumn {
	width: 150px;
	float: left;
	height: 300px;/*	background-image: Template/Images/Backgrounds/bg_leftcolumn.gif;
	background-repeat: repeat-y;
	background-position: left top;*/
/*#rightcolumn {
<div id="container">
  <div id="navbarwrap">
    <div id="navbar">
      <div id="navbarinner">
        <ul id="MenuBar1" class="MenuBarHorizontal">
          <li><a class="MenuBarItemSubmenu" href="#">Item 1</a>
              <li><a href="#">Item 1.1</a></li>
              <li><a href="#">Item 1.2</a></li>
          <li><a href="#">Item 2</a></li>
          <li><a href="#">Item 3</a></li>
          <li><a href="#">Item 4</a></li>
  <div id="header">
  <div id="leftcolumn">
    <p>left column</p>
  <div id="mainContent">
    <h1>h1 Level Heading </h1>
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at ... </p>
    <h2>h2 level heading </h2>
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at ... </p>
    <!-- end #mainContent -->
  <!-- end #container -->
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});

Open in new window

Who is Participating?
David S.Commented:
That's one of the problems with using overflow:hidden to contain floated elements. In this case you can give #navbarwrap float:left and #header clear:both

IE5-7 wrongly make elements contain their floated children in many situations. I suggest you read up on clearing and containing floats:
qengAuthor Commented:
Thanks.  Works like a charm.  You're a gift.
Will read up on the reference link you gave me.
I was setting this test file up in fact to try to troubleshoot another problem I was having with trying to make a vertical menu list's elements display their focussed state when the page which pertains to that link is loaded.  This is off-topic for this particular post so I will repost in a few minutes on the off-chance you might have few minutes to look at it and possibly guide me towards a solution.  This latter problem is a bit tricky because there are several cascaded sheets and dependency/specificity issues.  I've got it doing 'almost' what I want but can't get the links to display their focus state.  I'll try to explain properly in the next post.
qengAuthor Commented:
Thanks again Kravimir.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.