HTML condition comments and html comments
Previous
IE condition annotation is a non-standard logical statement provided by Microsoft since IE5. It allows you to flexibly import different html elements to browsers of different IE versions. Obviously, the biggest benefit of this method lies in the compatibility solution officially provided by Microsoft and the W3C validation.
Identify IE
Since IE10, ie does not support conditional annotations. Therefore, the following statement can only identify IE9-Browsers
[Note] there must be no space between the two -- and the left braces [; otherwise, it is invalid.
<! -- [If IE]> <div class = "box" id = "box"> </div> <! [Endif] -->
Identify a single IE
6 [if IE 6] 7 [if IE 7] 8 [if IE 8] 9 [if IE 9]
<! -- [If IE 7]> <div class = "box" id = "box"> </div> <! [Endif] -->
Recognition range: IE
Gt greater than or equal to gte lt less than or equal to lte
<! -- [If lte IE 7]> <div class = "box" id = "box"> </div> <! [Endif] -->
Identify non-IE
Actually, it recognizes IE10 + browsers and other non-ie browsers.
<! -- [If! IE]> <div class = "box" id = "box"> </div> <! [Endif] -->