Skip to content
0

Float, Clear, Isolation & Box Sizing ​

Control element floating, clear behavior, stacking context isolation, and box model calculations.

Float ​

ClassProperties
.float-leftfloat: left
.float-rightfloat: right
.float-nonefloat: none
.float-startfloat: start
.float-endfloat: end

Clear ​

ClassProperties
.clear-leftclear: left
.clear-rightclear: right
.clear-bothclear: both
.clear-startclear: start
.clear-endclear: end
.clear-noneclear: none

Basic Usage ​

html
<div class="float-left w-32">Floated left</div>
<div class="clear-both">Clears both sides</div>

Isolation ​

ClassProperties
.isolateisolation: isolate
.isolation-autoisolation: auto
html
<!-- Create a new stacking context -->
<div class="isolate">
  <div class="z-10">This z-index only affects siblings inside isolate</div>
</div>

Box Sizing ​

ClassProperties
.box-borderbox-sizing: border-box
.box-contentbox-sizing: content-box
html
<!-- Include padding and border in the element's total width/height -->
<div class="box-border w-64 p-4 border">
  Total width = 256px (padding and border included)
</div>

<!-- Exclude padding and border from width/height calculation -->
<div class="box-content w-64 p-4 border">
  Total width = 256px + padding + border
</div>

INFO

The framework reset sets box-sizing: border-box on all elements by default (*, *::before, *::after). Use .box-content to opt out when needed.

SCSS Source ​

scss
// From _utilities.scss
$float-list: (left, right, none, start, end) !default;
$clear-list: (left, right, both, start, end, none) !default;
$isolation-list: (isolate, auto) !default;
$box-sizing-list: (border, content) !default;

Released under the MIT License.