in English
Clearfix
Sai sai thiab yooj yim tshem tawm cov ntsiab lus ntab hauv lub thawv los ntawm kev ntxiv cov khoom siv clearfix.
Yooj yim tshem float
s los ntawm kev ntxiv .clearfix
rau cov niam txiv keeb . Kuj tseem siv tau los ua ib qho mixin.
<div class="clearfix">...</div>
// Mixin itself
@mixin clearfix() {
&::after {
display: block;
content: "";
clear: both;
}
}
// Usage as a mixin
.element {
@include clearfix;
}
Cov piv txwv hauv qab no qhia tau hais tias qhov clearfix siv tau li cas. Yog tsis muaj qhov clearfix lub wrapping div yuav tsis span nyob ib ncig ntawm cov nyees khawm uas yuav ua rau ib tug tawg layout.
<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>