box-sizing

Class Description

box-border

Sets box-sizing to border-box, including padding and borders in the element's total width and height.

CSS Rules

.box-border {
  box-sizing: border-box;
}

Usage

<element class="box-border" />

Responsive

Prefix .box-border utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:box-border" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="box-border:hover" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="box-border:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before box-border::before" />

<element class="content-after box-border::after" />
.box-border Sets box-sizing to border-box, including padding and borders in the element's total width and height.

box-content

Sets box-sizing to content-box, excluding padding and borders from the element's total width and height.

CSS Rules

.box-content {
  box-sizing: content-box;
}

Usage

<element class="box-content" />

Responsive

Prefix .box-content utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:box-content" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="box-content:hover" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="box-content:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before box-content::before" />

<element class="content-after box-content::after" />
.box-content Sets box-sizing to content-box, excluding padding and borders from the element's total width and height.