清除浮動

利用:after方法清除浮動(做用於浮動元素的父元素)chrome

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

 

bootstrap中清除浮動的方法bootstrap

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

// Usage as a Mixin
.element {
  .clearfix();
}
相關文章
相關標籤/搜索
本站公眾號
   歡迎關注本站公眾號,獲取更多信息