in English
Clearfix
Malajr u faċilment ċar kontenut galleġġjanti fi ħdan kontenitur billi żżid utilità clearfix.
Faċilment ċara float
s billi żżid .clearfix
mal-element ġenitur . Jista 'jintuża wkoll bħala mixin.
Uża fl-HTML:
<div class="clearfix">...</div>
Il-kodiċi tas-sors mixin:
@mixin clearfix() {
&::after {
display: block;
clear: both;
content: "";
}
}
Uża l-mixin f'SCSS:
.element {
@include clearfix;
}
L-eżempju li ġej juri kif il-clearfix jista' jintuża. Mingħajr il-clearfix id-div tat-tgeżwir ma jifrex madwar il-buttuni li jikkawża tqassim miksur.
<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>