Skip to main content

Background Position

Set the background image position within an element.

View as Markdown
baselinewidely
ClassCSS
bp:bbackground-position: bottom;
bp:cbackground-position: center;
bp:lbackground-position: 0;
bp:lbbackground-position: 0 100%;
bp:ltbackground-position: 0 0;
bp:rbackground-position: 100%;
bp:rbbackground-position: 100% 100%;
bp:rtbackground-position: 100% 0;
bp:tbackground-position: top;

Variants

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

Breakpoints

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

@xs:bp:ltFrom 32rem up.
@sm:bp:ltFrom 40rem up.
@md:bp:ltFrom 48rem up.
@lg:bp:ltFrom 64rem up.
@xl:bp:ltFrom 80rem up.
@xxl:bp:ltFrom 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:bp:ltContainer from 32rem up.
@c:sm:bp:ltContainer from 40rem up.
@c:md:bp:ltContainer from 48rem up.
@c:lg:bp:ltContainer from 64rem up.
@c:xl:bp:ltContainer from 80rem up.
@c:xxl:bp:ltContainer 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:bp:ltOn a touch screen.
@prm:bp:ltWith reduced motion on.
@st:bp:ltOn the first frame.

States

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

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

Pseudo Elements

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

a::bp:ltOn ::after.
b::bp:ltOn ::before.
p::bp:ltOn ::placeholder.
s::bp:ltOn ::selection.