Why the <h1> tag with clear both is at the bottom, if get rid of "clear both", it works fine, how can I get it work with clear both?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=gbk"/>
<style>
#left{
float:left;
width:200px;
height:400px;
background:#cfc;
}
#main{
margin-left:210px;
background:#f9c;
height:400px;
}
h1{
clear:both;
}
</style>
</head>
<body>
<div id="left"></div>
<div id="main">
<h1>test</h1>
</div>
</body>
</html>
So if you (for any reason) need to apply clear both to your H1 and at the same time get to avoid the constrain related to your previous floating box, you must absolute position main . You will need a containing block as well so I added the div container relative positioned