in English
Clearfix
Gancang sareng gampang mupus eusi ngambang dina wadah ku cara nambihan utilitas clearfix.
Gampang mupus float
s ku nambahkeun .clearfix
kana unsur indungna . Ogé bisa dipaké salaku mixin a.
Paké dina HTML:
<div class="clearfix">...</div>
Kode sumber mixin:
@mixin clearfix() {
&::after {
display: block;
clear: both;
content: "";
}
}
Anggo mixin dina SCSS:
.element {
@include clearfix;
}
Conto di handap ieu nunjukkeun kumaha clearfix tiasa dianggo. Tanpa clearfix div wrapping moal bentang sabudeureun tombol nu bakal ngabalukarkeun perenah 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>