Skip to main content

Grayscale

Set the grayscale filter for an element.

View as Markdown
baselinewidely
ClassCSS
fgr:0filter: grayscale(0%);
fgr:10filter: grayscale(10%);
fgr:20filter: grayscale(20%);
fgr:30filter: grayscale(30%);
fgr:40filter: grayscale(40%);
fgr:50filter: grayscale(50%);
fgr:60filter: grayscale(60%);
fgr:70filter: grayscale(70%);
fgr:80filter: grayscale(80%);
fgr:90filter: grayscale(90%);
fgr:100filter: grayscale();

Variants

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

Breakpoints

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

@xs:fgr:50From 32rem up.
@sm:fgr:50From 40rem up.
@md:fgr:50From 48rem up.
@lg:fgr:50From 64rem up.
@xl:fgr:50From 80rem up.
@xxl:fgr:50From 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:fgr:50Container from 32rem up.
@c:sm:fgr:50Container from 40rem up.
@c:md:fgr:50Container from 48rem up.
@c:lg:fgr:50Container from 64rem up.
@c:xl:fgr:50Container from 80rem up.
@c:xxl:fgr:50Container 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:fgr:50On a touch screen.
@prm:fgr:50With reduced motion on.
@st:fgr:50On the first frame.

States

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

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

Pseudo Elements

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

a::fgr:50On ::after.
b::fgr:50On ::before.
p::fgr:50On ::placeholder.
s::fgr:50On ::selection.