Problem Description When <html> <head> <title>css filter issue</title> <style> body { height: 600px; background: red; filter: grayscale(1); /* Key code*/ } .fixed { color: yellow; position: fixed; top: 0; right: 0; } </style> </head> <body> <div class="fixed">fixed item</div> </body> </html> The effect diagram is as follows: Note that Solution The reason for this problem is: when In the above example, when However, if the filter acts on the root element (ie, the HTML tag), it will not create a new containing block for the absolute or fixed child elements. Reference: https://drafts.fxtf.org/filter-effects/#FilterProperty So the solution is very simple, just put the html { filter: grayscale(1); } Extensions 1. When an element includes the Additionally, Reference: https://www.w3.org/TR/css-position-3/#fixed-pos 2. The difference between the two can be found in this blog: http://phrogz.net/css/htmlvsbody.html ps: HTML element is max(screen height <viewport height>, internal element height <body element height>) This concludes this article on the causes and solutions for conflicts between filters and fixed. For more information on conflicts between filters and fixed, please search previous articles on 123WORDPRESS.COM or continue to browse the related articles below. We hope that everyone will support 123WORDPRESS.COM in the future! |
<<: Recommended tips for web front-end engineers
>>: A detailed introduction to the basics of Linux scripting
The following information is compiled from the Int...
Table of contents defineComponent overload functi...
Table of contents Hidden Problems Solution to ada...
Most people have heard of the concept of server-s...
What is the purpose of this sentence? Copy code Th...
theme Today I will teach you how to create a circ...
There are many Hadoop installation tutorials on L...
Table of contents 1. Concept 1.1 Definition 1.2 D...
Aggregating data from various sources allows the ...
Occasionally, I need to group select contents. In ...
First: Start and stop the mysql service net stop ...
Change personal account password If ordinary user...
This article example shares the specific code of ...
By default, the border of the table is 0, and we ...
This article shares the specific code for JavaScr...