Skip to main content

Text Wrap

Set how text wraps within an element.

View as Markdown
baselinenewly
ClassCSS
tw:btext-wrap: balance;
tw:ntext-wrap: nowrap;
tw:ptext-wrap: pretty;
tw:wtext-wrap: wrap;

Variants

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

Breakpoints

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

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

States

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

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

Pseudo Elements

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

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