Source

Clearfix

Ni iyara ati irọrun ko akoonu ti o leefofo kuro laarin apo eiyan kan nipa fifi ohun elo clearfix kan kun.

Ni irọrun ko floats nipa fifi kun .clearfix si nkan obi . Tun le ṣee lo bi apopọ.

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

// Usage as a mixin
.element {
  @include clearfix;
}

Awọn wọnyi apẹẹrẹ fihan bi clearfix le ṣee lo. Laisi clearfix awọn murasilẹ div yoo ko igba ni ayika awọn bọtini eyi ti yoo fa kan baje akọkọ.

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