Hi matthew,
If you float elements like this you can stop elements from being pushed down by setting width on the main control div (container). You can change the width of #container of this to suite your taste.
You couldn't see the red background because one of the elements was floated. To fix this I added a div with style to clear the floats.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html
<html>
<head>
<title>Test Matthew</title>
<meta http-equiv="content-type" content="text/html;charset
<style type="text/css">
<!--
* { margin:0px; padding:0px; }
#container { background-color:red; width: 760px; }
#menu { width: 180px; height: 800px; background-color: blue; float: left; }
#content { background-color:yellow; }
.clearer {
height:1px;
overflow:hidden;
margin-top:-1px;
clear:both;
display: block;
}
-->
</style>
</head>
<body>
<div id="container">
<div id="menu">aaaa</div>
<div id="content">
<form method="post" action="myAction.php"">
<p>
<select size="5" name="collection" style="width: 500px" id="idCollectionSelect">
<option value="test 1">Test 1
<option value="test 2">Test 2
<option value="test 3">Test 3
</select>
<br>
<input value="Test" type="submit"/>
</p>
</form>
</div>
<div class="clearer"></div>
</div>
</body>
</html>
-klykken
Main Topics
Browse All Topics





by: ArgblatPosted on 2007-03-30 at 07:43:21ID: 18823737
To stop your elements from getting pushed to the bottom add white-space: nowrap to your #container element
#container {
background-color:red;
white-space: nowrap;
}
You can't see the red background of #container because #menu and #content have their own colors and are sitting on top of (blocking out) #container
Try removing the background color from #content and you will see that the red shines through