Summary
Flips an element’s colors, for use by the filter property. A decimal value between 0 and 1 or percentage up to 100% controls the extent of the color-negative effect, with 0.5 or 50% producing gray.
This CSS property value is reflected in the following image:
filter: invert(100%); filter: invert(1); /* same */
Compatibility
There is no data available for topic “css”, feature “invert”. If you think that there should be data available, consider opening an issue.
Examples
View live exampleThe following example shows the difference between two images, where one has a been inverted for 75%:
HTML
<!DOCTYPE html>
<html>
<head>
<title>Filter example</title>
<style>
.foo {
float: left;
}
.bar {
-webkit-filter: invert(75%);
}
</style>
</head>
<body>
<img src="http://www.webplatform.org/logo/wplogo_transparent_xlg.png" class="foo" />
<img src="http://www.webplatform.org/logo/wplogo_transparent_xlg.png" class="foo bar" />
</body>
</html>
近期评论