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 Preface 1. Application componen...
This article example shares the specific code of ...
An error message appears when MySQL is started in...
Using the CSS float property correctly can become...
Many times we want the server to run a script reg...
DPlayer.js video player plug-in is easy to use Ma...
Install the unzipped version of Mysql under win10...
How to solve the problem of being unable to acces...
This article shares the specific code for Vue to ...
Table of contents Transaction Isolation Level Wha...
Through the brief introduction in the previous tw...
Overview The framework diagram of this article is...
Many tables in MySQL contain columns that can be ...
The installation process of VMwarea will not be d...
I joined a new company these two days. The compan...