The use of CSS conditional annotation teaching materials _ Experience Exchange
Source: Internet
Author: User
Statement: The following content collected in the network, after the talent understanding, to organize editing, reprint please keep the Wit station link, thank you!!!
Notes of wit: http://blog.54caizi.com
Friends who play Web refactoring believe that there is a similar distress, that is because the browser version of the different, some elements in the CSS interpretation is not the same, the wit of course also encountered the same problem, but also collected some solutions, wit before two for browser version of different and choose different CSS code, Interested friends to find their own.
In fact, we can also use conditional annotation method to achieve similar purposes, what is a conditional annotation, wit also here briefly, nothing more than a few if judgments, hehe, but these judgments are not executed in the script, but directly in the HTML code execution, the following to introduce the use of the method bar.
<!--[If xxx]>
This is normal HTML code.
<! [endif]-->
Here xxx is a few specific dongdong, in this list several come out, details their respective meanings:
<!--[if ie]>/if the browser is IE/
<!--[if IE 5]>/If the browser is a version of IE 5/
<!--[if IE 6]>/If the browser is a version of IE 6/
<!--[if IE 7]>/If the browser is a version of IE 7/
......
The above is a few commonly used to judge IE browser version of the syntax, below to introduce a relatively less logical judgment parameters:
There are several parameters: LTE,LT,GTE,GT and!
The respective detailed explanations are as follows:
LTE: Is the shorthand for less than or equal to, meaning less than or equal to.
LT: It is the shorthand for less than, which means less than.
GTE: is the shorthand for greater than or equal to, which is greater than or equal to the meaning.
GT: is the shorthand for greater than, which means greater than.
! : Is not equal to the meaning, and JavaScript is not equal to the same judge, ^0^
Write a few examples:
<!--[if GT ie 5.5]>/If IE version is greater than 5.5/
<!--[if LTE IE 6]>/if IE version is less than or equal to 6/
<!--[if! ie]>/If the browser is not IE/
......
See here I believe everyone has understood the use of conditional annotations, OK, let's take an example:
<!--call the CSS.CSS style sheet by default first-->
<link rel= "stylesheet" type= "Text/css" href= "Css.css"/>
<!--[If Lt IE 6]>
<!--if IE browser version is less than 6, call 2.CSS style sheet-->
<link rel= "stylesheet" type= "Text/css" href= "2.css"/>
<! [endif]-->
The detailed use of the method has been introduced, have to mention the point is:
Conditional comments are supported by IE after Ie5.0/win, which is not valid for IE5 's previous browsers, but there should be no one else using the IE4 version. ^0^
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.