Skip to content

Instantly share code, notes, and snippets.

@adikahorvath
Created January 5, 2014 11:11
Show Gist options
  • Save adikahorvath/8266965 to your computer and use it in GitHub Desktop.
Save adikahorvath/8266965 to your computer and use it in GitHub Desktop.
CSS clear types
/* 1 */
.clear {
clear: both;
font: 0/0 a;
height: 0;
visibility: hidden;
}
/* 2 */
.clear:before,
.clear:after {
clear: both;
content: " ";
display: table;
}
/* 3 */
.clear { overflow: hidden; }
<!-- 1 -->
<div style="float:left;width:50%"></div>
<div style="float:left;width:50%"></div>
<div class="clear"></div>
<!-- 2 -->
<div class="clear">
<div style="float:left;width:50%"></div>
<div style="float:left;width:50%"></div>
</div>
<!-- 3 -->
<div class="clear">
<div style="float:left;width:50%"></div>
<div style="float:left;width:50%"></div>
</div>
<!-- obsolete -->
<div style="float:left;width:50%"></div>
<div style="float:left;width:50%"></div>
<br clear="all" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment