Skip to main content

Box Sizing

Set the box sizing model for an element.

View as Markdown
baselinewidely
ClassCSS
bs:bbbox-sizing: border-box;
bs:cbbox-sizing: content-box;

Variants

Prefix any class with a variant to apply it only under that condition. Variants stack, as in @md:h:bs:cb.

Breakpoints

Apply a class from a viewport width up. Each breakpoint covers its width & every width above it.

@xs:bs:cbFrom 32rem up.
@sm:bs:cbFrom 40rem up.
@md:bs:cbFrom 48rem up.
@lg:bs:cbFrom 64rem up.
@xl:bs:cbFrom 80rem up.
@xxl:bs:cbFrom 96rem up.

Containers

Apply a class from a container's width up, not the viewport's. Mark the parent with ct:is first.

@c:xs:bs:cbContainer from 32rem up.
@c:sm:bs:cbContainer from 40rem up.
@c:md:bs:cbContainer from 48rem up.
@c:lg:bs:cbContainer from 64rem up.
@c:xl:bs:cbContainer from 80rem up.
@c:xxl:bs:cbContainer from 96rem up.

Media

Apply a class when the device or the page matches a condition, or on the first frame an element renders.

@pc:bs:cbOn a touch screen.
@prm:bs:cbWith reduced motion on.
@st:bs:cbOn the first frame.

States

Apply a class only while the element is in a state, such as hovered, focused or checked.

h:bs:cbOn :hover.
f:bs:cbOn :focus.
fv:bs:cbOn :focus-visible.
a:bs:cbOn :active.
d:bs:cbOn :disabled.
fc:bs:cbOn :first-child.
c:bs:cbOn :checked.
e:bs:cbOn :empty.
fw:bs:cbOn :focus-within.
i:bs:cbOn :invalid.
in:bs:cbOn :indeterminate.
lc:bs:cbOn :last-child.
nc:bs:cbOn :nth-child.
r:bs:cbOn :required.
ro:bs:cbOn :read-only.
v:bs:cbOn :valid.

Pseudo Elements

Style a part of the element rather than the element itself, such as its placeholder or the selected text.

a::bs:cbOn ::after.
b::bs:cbOn ::before.
p::bs:cbOn ::placeholder.
s::bs:cbOn ::selection.