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
Table of contents 1. Introduction 2. Principle II...
Table of contents Use of this.$set in Vue use Why...
Recently, the company has begun to evaluate all s...
String extraction without delimiters Question Req...
JDK Installation I won't go into too much det...
Table of contents Mind Map Simple understanding E...
Written in front Recently, a reader told me that ...
Table of contents Preface Achieve results Code CS...
The so-called sliding door technology means that ...
After I set up the PHP development environment on...
Teaching Topics Web page Applicable grade Second ...
Use the following command to create a container a...
First, the server environment information: Reason...
Table of contents VMware BurpSuite 1. Virtual mac...
Anchor tag usage: Linking to a specific location i...