首页 > 代码库 > 清楚浮动

清楚浮动

利用:after方法清除浮动(作用于浮动元素的父元素)

.clear { zoom: 1;}  /* for  ie6/7  */.clear :after{clear:both; content:"";display:block; visibility:hidden;}  /*==for FF/chrome/opera/IE8==*/

 

bootstrap中清除浮动的方法

// Mixin itself.clearfix() {  &:before,  &:after {    content: " ";    display: table;  }  &:after {    clear: both;  }}// Usage as a Mixin.element {  .clearfix();}

 

清楚浮动