Skip to main content

Background Origin

Set the background positioning area relative to borders, padding & content.

View as Markdown
baselinewidely
ClassCSS
bo:bbbackground-origin: border-box;
bo:cbbackground-origin: content-box;
bo:pbbackground-origin: padding-box;

Variants

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

Breakpoints

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

@xs:bo:cbFrom 32rem up.
@sm:bo:cbFrom 40rem up.
@md:bo:cbFrom 48rem up.
@lg:bo:cbFrom 64rem up.
@xl:bo:cbFrom 80rem up.
@xxl:bo: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:bo:cbContainer from 32rem up.
@c:sm:bo:cbContainer from 40rem up.
@c:md:bo:cbContainer from 48rem up.
@c:lg:bo:cbContainer from 64rem up.
@c:xl:bo:cbContainer from 80rem up.
@c:xxl:bo: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:bo:cbOn a touch screen.
@prm:bo:cbWith reduced motion on.
@st:bo:cbOn the first frame.

States

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

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

Pseudo Elements

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

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