in English

Clearfix

Gancang sareng gampang mupus eusi ngambang dina wadah ku cara nambihan utilitas clearfix.

Gampang mupus floats ku nambahkeun .clearfix kana unsur indungna . Ogé bisa dipaké salaku mixin a.

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

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