Explanation: The above css is in Firefox. It cannot recognize the stuff with an asterisk * at the back, so it filters it out and ignores it. The result of the analysis is :div{background:green}, so of course the background of this div is green. In IE6, both backgrounds can be recognized, and the result of its analysis is: div{background:green;background:red;}, so according to the priority level, the red at the back has a higher priority. , so of course the background color of this div is red.
CSS hack: Distinguish between IE6, IE7, firefox Distinguish between different browsers, CSS hack writing method:
Distinguish between IE6 and FF: background:orange;*background :blue;
The difference between IE6 and IE7: background:green !important;background:blue;
The difference between IE7 and FF: background:orange; *background:green;
Difference between FF, IE7 and IE6: background:orange;*background:green !important;*background:blue;
Note: IE can recognize *; standard browser ( For example, FF) cannot recognize *; IE6 can recognize *, but not !important, IE7 can recognize *, and it can also recognize !important; FF cannot recognize *, but can recognize !important;
IE6 IE7 FF * √ × !important √
Add one more, underscore "_", IE6 supports underscore, IE7 Neither Firefox nor Firefox supports underscores.
So you can also distinguish IE6, IE7, firefox in this way background:orange;*background:green;_background:blue;
Note: No matter what method is used, the order of writing Firefox is written at the front, IE7 is written in the middle, and IE6 is written at the end.
Attachment: CSS browser compatibility table in one column
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn