?
This document uses PHP Chinese website manual Release
通過添加一個clearfix實用程序,快速輕松地清除容器中的浮動內(nèi)容。
通過添加.clearfix
到父元素可輕松清除float
s 。也可以用作混音。
<div class="clearfix">...</div>
// Mixin itself@mixin clearfix() { &::after { display: block; content: ""; clear: both; }}// Usage as a mixin.element { @include clearfix;}
以下示例顯示了如何使用clearfix。如果沒有clearfix,則換行div不會跨越會導(dǎo)致布局破碎的按鈕。
<div class="bg-info clearfix"> <button type="button" class="btn btn-secondary float-left">Example Button floated left</button> <button type="button" class="btn btn-secondary float-right">Example Button floated right</button></div>