Twe kɔ emu nsɛm atitiriw no so Twe kɔ docs navigation so
in English

Clearfix a ɛyɛ pefee

Ntɛm na ɛnyɛ den sɛ wobɛpopa nneɛma a ɛsensɛn nsu mu wɔ ade bi mu denam clearfix utility a wode bɛka ho no so.

Ɛnyɛ den sɛ wobɛtew floats so denam .clearfix ɔwofo element no a wode bɛka ho no so . Wobetumi nso de adi dwuma sɛ mixin.

Fa di dwuma wɔ HTML mu:

<div class="clearfix">...</div>

Mixin no fibea koodu:

@mixin clearfix() {
  &::after {
    display: block;
    clear: both;
    content: "";
  }
}

Fa mixin no di dwuma wɔ SCSS mu:

.element {
  @include clearfix;
}

Nhwɛsoɔ a ɛdidi soɔ yi kyerɛ sɛdeɛ wɔbɛtumi de clearfix no adi dwuma. Sɛ ɛnyɛ clearfix no a, wrapping div no rentumi ntwa buttons no ho hyia a ɛbɛma layout no abubu.

<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>