filter: brightness()

Các tiện ích để áp dụng bộ lọc brightness cho một phần tử.

ClassStyles
brightness-<number>
filter: brightness(<number>%);
brightness-(<custom-property>)
filter: brightness(var(<custom-property>));
brightness-[<value>]
filter: brightness(<value>);

Ví dụ

Ví dụ cơ bản

Sử dụng các tiện ích như brightness-50brightness-100 để kiểm soát độ sáng của một phần tử:

brightness-50

brightness-100

brightness-125

brightness-200

<img class="brightness-50 ..." src="/img/mountains.jpg" /><img class="brightness-100 ..." src="/img/mountains.jpg" /><img class="brightness-125 ..." src="/img/mountains.jpg" /><img class="brightness-200 ..." src="/img/mountains.jpg" />

Sử dụng giá trị tùy chỉnh

Use the brightness-[<value>] syntax to set the brightness based on a completely custom value:

<img class="brightness-[1.75] ..." src="/img/mountains.jpg" />

For CSS variables, you can also use the brightness-(<custom-property>) syntax:

<img class="brightness-(--my-brightness) ..." src="/img/mountains.jpg" />

This is just a shorthand for brightness-[var(<custom-property>)] that adds the var() function for you automatically.

Responsive design

Prefix a filter: brightness() utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

<img class="brightness-110 md:brightness-150 ..." src="/img/mountains.jpg" />

Learn more about using variants in the variants documentation.

Copyright © 2025 Tailwind Labs Inc.·Chính sách thương hiệu