?
Dokumen ini menggunakan Manual laman web PHP Cina Lepaskan
通過(guò)添加一個(gè)clearfix實(shí)用程序,快速輕松地清除容器中的浮動(dòng)內(nèi)容。
通過(guò)添加.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。如果沒(méi)有clearfix,則換行div不會(huì)跨越會(huì)導(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>