Sometimes if judgment is required.
In ie CSS hack (more methods), if IE is often used to determine the browser type to solve the compatibility problem of CSS and even Js, before that, you may know that if IE is used to solve CSS compatibility issues. In fact, if IE is not only used for CSS hack. We can even use if IE for JS processing in front-end development, see the followingCode:
Reference <! -[If IE 5]> <SCRIPT> document. Write ("only ie5.0 and ie5.5 can recognize"); </SCRIPT> <! [Endif]->
<! -[If gte ie 5.0]> <SCRIPT> document. Write ("Both ie5.0 and ie5.0 can be identified"); </SCRIPT> <! [Endif]->
<! -[If IE 6]> <SCRIPT> document. Write ("only IE6 identifiable"); </SCRIPT> <! [Endif]->
<! -[If lt IE 6]> <SCRIPT> document. Write ("recognizable for versions earlier than IE6"); </SCRIPT> <! [Endif]->
<! -[If gte ie 6]> <SCRIPT> document. Write ("recognizable IE6 or later versions); </SCRIPT> <! [Endif]->
<! -[If IE 7]> <SCRIPT> document. Write ("only IE7 identifiable"); </SCRIPT> <! [Endif]->
<! -[If lt IE 7]> <SCRIPT> document. Write ("recognizable versions earlier than IE7"); </SCRIPT> <! [Endif]->
<! -[If gte ie 7]> <SCRIPT> document. Write ("recognizable IE7 and IE7 versions); </SCRIPT> <! [Endif]->
The following is a detailed explanation of if IE:
LTE: Short for less than or equal to, that is, less than or equal.
LT: Short for less than, that is, less.
GTE: Short for greater than or equal to, that is, greater than or equal.
GT: Short for greater than, that is, greater.
! : It means not equal to, which is the same as the non-equal identifier in JavaScript.
Of course, we can also use if IE annotations to introduce JS files and CSS hack (more methods) files, as shown in the following code:
<! -[If lte ie 6]>
<! -If the iebrowser is smaller than or equal to 6, use the ie6.css style sheet.->
<LINK rel = "stylesheet" type = "text/CSS" href = "http://www.js8.in/ie6.css"/>
<! [Endif]->