in English
Clearfix
Cepet lan gampang mbusak konten sing ngambang ing wadhah kanthi nambah utilitas clearfix.
Gampang mbusak float
s kanthi nambahake .clearfix
unsur induk . Bisa uga digunakake minangka campuran.
Gunakake ing HTML:
<div class="clearfix">...</div>
Kode sumber mixin:
@mixin clearfix() {
&::after {
display: block;
clear: both;
content: "";
}
}
Gunakake mixin ing SCSS:
.element {
@include clearfix;
}
Conto ing ngisor iki nuduhake carane clearfix bisa digunakake. Tanpa clearfix, div bungkus ora bakal ngubengi tombol sing bakal nyebabake tata letak sing rusak.
<div class="bg-info clearfix">
<button type="button" class="btn btn-secondary float-start">Example Button floated left</button>
<button type="button" class="btn btn-secondary float-end">Example Button floated right</button>
</div>