Source

Clearfix

Glan go tapa agus go héasca ábhar ar snámh laistigh de choimeádán trí fhóntas clearfix a chur leis.

Glan s go héasca floattrí chur .clearfix leis an eilimint tuismitheora . Is féidir é a úsáid freisin mar mheascán.

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

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

Léiríonn an sampla seo a leanas conas is féidir an soiléirshocrú a úsáid. Gan an socrú soiléir ní bheadh ​​an div timfhilleadh thart ar na cnaipí, rud a chuirfeadh leagan amach briste.

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