Skip to content

Instantly share code, notes, and snippets.

@xiaody
Created October 13, 2012 04:25
Show Gist options
  • Save xiaody/3883210 to your computer and use it in GitHub Desktop.
Save xiaody/3883210 to your computer and use it in GitHub Desktop.
clear the float
/**
* clear the float
*/
#main_container {
width: 400px;
margin: 20px auto;
border: 2px solid #cccccc;
padding: 5px;
/*overflow:hidden;*/
}
#main_container::after {
content: "";
display: block;
clear: both;
}
.floated_box {
float: left;
width: 100px;
height: 100px;
border: 1px solid #990000;
margin: 10px;
}
<!-- content to be placed inside <body>…</body> -->
<div id="main_container">
<p>Some content.</p>
<div class="floated_box"></div>
<div class="floated_box"></div>
<div class="floated_box"></div>
<div class="floated_box"></div>
<div class="floated_box"></div>
<!--<div style="clear: both;"></div>-->
</div>
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment