Source

Clearfix

Malajr u faċilment ċar kontenut galleġġjanti fi ħdan kontenitur billi żżid utilità clearfix.

Faċilment ċara floats billi żżid .clearfix mal-element ġenitur . Jista 'jintuża wkoll bħala mixin.

<div class="clearfix">...</div>
// Mixin itself
@mixin clearfix() {
  &::after {
    display: block;
    content: "";
    clear: both;
  }
}

// Usage as a mixin
.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-left">Example Button floated left</button>
  <button type="button" class="btn btn-secondary float-right">Example Button floated right</button>
</div>