Link to home
Create AccountLog in
HTML

HTML

--

Questions

--

Followers

Top Experts

Avatar of qeng
qeng

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?

Thx


<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>menutest2</title>
<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" />
<style>
/*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 {
	font-weight:normal;
}
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;*/
	background-color:#0066FF;
	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 {
}*/
</style>
</head>
<body>
<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>
            <ul>
              <li><a href="#">Item 1.1</a></li>
              <li><a href="#">Item 1.2</a></li>
            </ul>
          </li>
          <li><a href="#">Item 2</a></li>
          <li><a href="#">Item 3</a></li>
          <li><a href="#">Item 4</a></li>
        </ul>
      </div>
    </div>
  </div>
  <div id="header">
    <p>header</p>
  </div>
  <div id="leftcolumn">
    <p>left column</p>
  </div>
  <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 -->
  </div>
  <!-- end #container -->
</div>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
</html>

Open in new window

Overflow-Hidden-OFF-or-ON-IE7.png
Overflow-Hidden-ON-FF3.png
Overflow-Hidden-OFF-FF3.png

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


ASKER CERTIFIED SOLUTION
Avatar of David S.David S.🇺🇸

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of qengqeng

ASKER

Kravimir,
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.

Avatar of qengqeng

ASKER

Thanks again Kravimir.

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.

HTML

HTML

--

Questions

--

Followers

Top Experts

HTML (HyperText Markup Language) is the main markup language for creating web pages and other information to be displayed in a web browser, providing both the structure and content for what is sent from a web server through the use of tags. The current implementation of the HTML specification is HTML5.