Skip to content

Instantly share code, notes, and snippets.

@shihongzhi
Last active December 17, 2015 12:29
Show Gist options
  • Save shihongzhi/5610122 to your computer and use it in GitHub Desktop.
Save shihongzhi/5610122 to your computer and use it in GitHub Desktop.
当没有后续节点之后,但是又想使用clear:both,清楚float。 则可以通过这段代码,设置父节点的style
.clearfix:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
.clearfix {
display: inline-block;
}
html[xmlns] .clearfix {
display: block;
}
* html .clearfix {
height: 1%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment