I am trying to have a "language" pull down menu (form) inside a DIV but no matter what I do the pull down menu gets thrown underneath the DIV tag instead of inside. Why? Anybody? Here is the code. Thanks !! <!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>Two Columns Fixed</title> <script type="text/javascript"> <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } //--> </script> <style type="text/css"> body { color: #000000; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */ margin: 0px; padding: 0px; background-color: #666666; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */ text-align: center; } #container { width: 960px; /* 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. */ margin-top: 0; margin-right: auto; margin-bottom: 0; margin-left: auto; background-color: #0066FF; } #header { height: 120px; padding-top: 0; padding-right: 10px; padding-bottom: 0; padding-left: 20px; color: #FFFFFF; background-color: #000099; } #header h1 { margin: 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */ padding-top: 10px; padding-right: 0; padding-bottom: 10px; padding-left: 0; } #nav { background-color: #CCCCCC; margin: 0px; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 20px; } #topContent { background-color: #00CCFF; font-size: 10px; color: #0033CC; height: 18px; } #sidebar { float: right; /* since this element is floated, a width must be given */ width: 185px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */ background: #EBEBEB; margin-right: 8px; padding-top: 15px; padding-right: 20px; padding-bottom: 15px; padding-left: 15px; margin-top: 20px; } #mainContent { background-color: #E4E4E4; margin-right: 240px; margin-bottom: 0; margin-left: 8px; padding-top: 10; padding-right: 20px; padding-bottom: 0; padding-left: 20px; margin-top: 0px; } #footer { padding: 0 10px 0 20px; background-color: #0033CC; color: #FFFFFF; } #footer p { margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */ padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */ } .floatRight { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ float: right; margin-left: 8px; } .floatLeft { /* this class can be used to float an element left in your page */ float: left; margin-right: 8px; } .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */ clear:both; height:0; font-size: 1px; line-height: 0px; } </style> </head> <body class="twoColFixRtHdr"> <p> </p> <div id="container"> <div id="header"> <h1>Header</h1> <!-- end #header --></div> <div id="nav"> Home • About Us • Contact Us<!-- end #nav --></div> <div id="topContent"> <form name="form" id="form"> <select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)"> <option>English</option> <option selected="selected">Espanol</option> </select> </form> </div> <div id="sidebar"> <h3>Sidebar Content</h3> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla. <!-- end #sidebar1 --> <br /> <br /> </p> </div> <div id="mainContent"> <h1> Main Content </h1> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam. See it oolestie in, commodo porttitor, felis. Nam blandit quam ut lacuare risus quis ligula. Phasellus tristet, tincidunt nec, suscipit id, libero. In eget purus. Vestibulum ut nisl. Donec eu mi sed turpis feugiat feugiat. Integer turpis arcu, pellentesque eget, cursus et, fermentum ut, sapien. Fusce metus mi, eleifend sollicitudin, molestie id. </p> <h2>H2 level heading </h2> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erre risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio.</p> <p> </p> <!-- end #mainContent --></div> <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" /> <div id="footer"> <p align="center" class="style2">Footer</p> <!-- end #footer --></div> <!-- end #container --></div> </body> </html> Code (markup):
Try replacing your #topContent {} with this one #topContent { background-color: #00CCFF; color: #0033CC; } HOWEVER -- You don't have to listen to this, but if I were you, I would have your layout set as the following: (cause it looks better) Preview <!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>Two Columns Fixed</title> <script type="text/javascript"> <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } //--> </script> <style type="text/css"> body { color: #000000; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */ margin: 0px; padding: 0px; background-color: #666666; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */ text-align: center; } #container { width: 960px; /* 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. */ margin-top: 0; margin-right: auto; margin-bottom: 0; margin-left: auto; background-color: #0066FF; } #header { height: 120px; padding-top: 0; padding-right: 10px; padding-bottom: 0px; padding-left: 20px; color: #FFFFFF; background-color: #000099; } #header h1 { margin: 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */ padding-top: 10px; padding-right: 0; padding-bottom: 10px; padding-left: 0; } #nav { background-color: #CCCCCC; margin: 0px; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 20px; } #menu { float: left; } #lang { float: right; } #sidebar { float: right; /* since this element is floated, a width must be given */ width: 185px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */ background: #EBEBEB; margin-right: 8px; padding-top: 15px; padding-right: 20px; padding-bottom: 15px; padding-left: 15px; margin-top: 20px; } #mainContent { background-color: #E4E4E4; margin-right: 240px; margin-bottom: 0; margin-left: 8px; padding-top: 10; padding-right: 20px; padding-bottom: 0; padding-left: 20px; margin-top: 0px; } #footer { padding: 0 10px 0 20px; background-color: #0033CC; color: #FFFFFF; } #footer p { margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */ padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */ } .floatRight { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ float: right; margin-left: 8px; } .floatLeft { /* this class can be used to float an element left in your page */ float: left; margin-right: 8px; } .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */ clear:both; height:0; font-size: 1px; line-height: 0px; } </style> </head> <body class="twoColFixRtHdr"> <p> </p> <div id="container"> <div id="header"> <h1>Header</h1> <!-- end #header --> </div> <div id="nav"> <div id="menu">Home • About Us • Contact Us</div> <div id="lang"> <form name="form" id="form"> <select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)"> <option>English</option> <option selected="selected">Espanol</option> </select> </form> </div> <div style="clear:both;"></div> <!-- end #nav --> </div> <div id="sidebar"> <h3>Sidebar Content</h3> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla. <!-- end #sidebar1 --> <br /> <br /> </p> </div> <div id="mainContent"> <h1> Main Content </h1> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam. See it oolestie in, commodo porttitor, felis. Nam blandit quam ut lacuare risus quis ligula. Phasellus tristet, tincidunt nec, suscipit id, libero. In eget purus. Vestibulum ut nisl. Donec eu mi sed turpis feugiat feugiat. Integer turpis arcu, pellentesque eget, cursus et, fermentum ut, sapien. Fusce metus mi, eleifend sollicitudin, molestie id. </p> <h2>H2 level heading </h2> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erre risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio.</p> <p> </p> <!-- end #mainContent --> </div> <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --> <br class="clearfloat" /> <div id="footer"> <p align="center" class="style2">Footer</p> <!-- end #footer --> </div> <!-- end #container --> </div> </body> </html> Code (markup):
Thank you for your reply Somesite. Actually, the HTML that I posted is just a simplified version of real full website that I am designing. In the real website each colored div has a different Background image. For the sake of troubleshooting, I carefully removed all embellishments and left a raw code. So changing the color of the element will not solve the issue As far as the proposed code, I have attached an image of how it renders in the browser that I have to code for which is IE5 (and IE6). Thanks again! Any other suggestions?
The containers "nav", "topContent" and form are block elements and won't stay inline together. Navigation items must be inline elements and form must be wrapped in an inline element such as span. The following works: <html> <head> <style type='text/css'> form {display:inline;clear:none;}</style> </head> <body> <div id="nav"> <span> Home • About Us • Contact Us </span> <span id='topContent'> <form name="form" id="form"> <select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)"> <option>English</option> <option selected="selected">Espanol</option> </select> </form> </span> </div> </body> </html>