<html>
<head>
<style type="text/css">
.container {
width: 900px;
border: 2px solid #333333;
padding-top: 30px;
padding-bottom: 30px;
}
.container_left {
border: 2px solid #FF00FF;
width: 650px;
float: left;
}
.container_right {
border: 2px solid #0000FF;
width: 225px;
float: right;
}
</style>
</head>
<body>
<div class="container">
<div class="container_left">
<div>LEFT CONTAINER</div>
<div>LEFT CONTAINER</div>
<div>LEFT CONTAINER</div>
</div>
<div class="container_right">
<div>RIGHT CONTAINER</div>
<div>RIGHT CONTAINER</div>
<div>RIGHT CONTAINER</div>
</div>
</div>
</body>
</html>
The result is:
I want a result like this:
to the outer div you might want to use the clearfix css, explained here: http://www.positioniseverything.net/easyclearing.html
Give the container a
or
see this page on quirksmode.org for details on the issue.
One option is to put in a
<div style="clear: both;"></div>
just before closing the container div.Apply .clear to your parent element.
A quick fix is to add
overflow: hidden
to your.container
.This is not the best solution per say, merely the quickest fix. Your best solution would be to implement and apply clearfix as it doesn't have issues with printing due to overflow.
In the event you use
overflow: auto
oroverflow: hidden
and a user attempts to print the page, content that does not fit on the printed page will be clipped because:This might be of help "Clearing a float container"