Menu

1 / 2

contrast() | CSS-Tricks

CSS-Tricks·Gabriel Shoyombo·6 months ago
#Krhz4S17
Reading 0:00
15s threshold

The CSS contrast() filter function increases or decreases the contrast of an element, either making colors pop out more or dulling them to gray. Unlike other filter functions like brightness() or saturate() , contrast() affects both saturation and lightness, keeping only the color’s hue.

.low { filter: contrast(50%); }

.normal { filter: contrast(100%); }

.high { filter: contrast(200%); }

The contrast() function is defined in the Filter Effects Module Level 1 specification.

Syntax

The official syntax for the contrast() function is:

<contrast()> = contrast( [ <number> | <percentage> ]?…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.