CSS invert() function
- Previous Page CSS inset() function
- Next Page CSS lab() function
- Go to the Previous Level CSS Function Reference Manual
Definition and usage
CSS's invert()
Filter functions are used to invert the color of the image.
- 100% (1) will invert the image completely
- 0% (0) will have no effect
Instance
Example 1
Invert the color of the image:
#img1 { filter: invert(0.3); } #img2 { filter: invert(70%); } #img3 { filter: invert(100%); }
Example 2
to invert()
with backdrop-filter
Used together:
div.transbox { background-color: rgba(255, 255, 255, 0.4); -webkit-backdrop-filter: invert(100%); backdrop-filter: invert(100%); padding: 20px; margin: 30px; font-weight: bold; }
CSS syntax
invert(amount)
Value | Description |
---|---|
amount |
Optional. Specify the degree of inversion, which can be a number or a percentage. 100% (1) will invert the element completely, 0% (0) represents the original image (no effect). The default value is 0. |
Technical details
Version: | CSS Filter Effects Module Level 1 |
---|
Browser support
The numbers in the table represent the first browser version that fully supports this function.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
18 | 12 | 35 | 6 | 15 |
Related pages
Reference:CSS filter attribute
Reference:CSS blur() function
Reference:CSS brightness() function
Reference:CSS contrast() function
Reference:CSS drop-shadow() function
Reference:CSS grayscale() function
Reference:CSS hue-rotate() function
Reference:CSS opacity() function
Reference:CSS saturate() function
Reference:CSS sepia() function
- Previous Page CSS inset() function
- Next Page CSS lab() function
- Go to the Previous Level CSS Function Reference Manual