Skip to main content

White Space

Set how white space & line wrapping are handled.

View as Markdown
baselinewidely
ClassCSS
ws:bswhite-space: break-spaces;
ws:nwhite-space: normal;
ws:nwwhite-space: nowrap;
ws:pwhite-space: pre;
ws:plwhite-space: pre-line;
ws:pwwhite-space: pre-wrap;

Variants

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

Breakpoints

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

@xs:ws:pFrom 32rem up.
@sm:ws:pFrom 40rem up.
@md:ws:pFrom 48rem up.
@lg:ws:pFrom 64rem up.
@xl:ws:pFrom 80rem up.
@xxl:ws:pFrom 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:ws:pContainer from 32rem up.
@c:sm:ws:pContainer from 40rem up.
@c:md:ws:pContainer from 48rem up.
@c:lg:ws:pContainer from 64rem up.
@c:xl:ws:pContainer from 80rem up.
@c:xxl:ws:pContainer 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:ws:pOn a touch screen.
@prm:ws:pWith reduced motion on.
@st:ws:pOn the first frame.

States

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

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

Pseudo Elements

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

a::ws:pOn ::after.
b::ws:pOn ::before.
p::ws:pOn ::placeholder.
s::ws:pOn ::selection.