filter: contrast()
Utilities for applying contrast filters to an element.
| Class | Styles |
|---|---|
contrast-<number> | |
filter: contrast(<number>%); |
|
| contrast-(<custom-property>) |
filter: contrast(var(<custom-property>));
|
| contrast-[<value>] |
filter: contrast(<value>);
|
Use utilities like contrast-50 and contrast-100 to control an element's contrast:
contrast-50
contrast-100
contrast-125
contrast-200
<img class="contrast-50 ..." src="/img/mountains.jpg" /><img class="contrast-100 ..." src="/img/mountains.jpg" /><img class="contrast-125 ..." src="/img/mountains.jpg" /><img class="contrast-200 ..." src="/img/mountains.jpg" />
Use the contrast-[<value>] syntax to set the contrast based on a completely custom value:
<img class="contrast-[.25] ..." src="/img/mountains.jpg" />
For CSS variables, you can also use the contrast-(<custom-property>) syntax:
<img class="contrast-(--my-contrast) ..." src="/img/mountains.jpg" />
This is just a shorthand for contrast-[var(<custom-property>)] that adds the var() function for you automatically.
Prefix a filter: contrast() utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:
<img class="contrast-125 md:contrast-150 ..." src="/img/mountains.jpg" />
Learn more about using variants in the variants documentation.
On this page

5-day mini-course
Build UIs that don’t suck.
Short, tactical video lessons from the creator of Tailwind CSS, delivered directly to your inbox every day for a week.
Copyright © 2026 Tailwind Labs Inc.·Trademark Policy