lte: 就是 Less than or equal to 的简写, 也就是小于或等于的意思
lt : 就是 Less than 的简写, 也就是小于的意思
gte: 就是 Greater than or equal to 的简写, 也就是大于或等于的意思
gt : 就是 Greater than 的简写, 也就是大于的意思
! : 就是不等于的意思, 跟 javascript 里的不等于判断符相同
例子一:
<!-[if IE 7]>
<!- 如果 IE 浏览器版是 7, 调用 ie7.CSS 样式表 - >
- <link rel="stylesheet" type="text/css" href="ie7.css" />
- <![endif]->
- <!-[if lte IE 6]>
<!- 如果 IE 浏览器版本小于等于 6, 调用 ie.css 样式表 ->
- <link rel="stylesheet" type="text/css" href="ie.css" />
- <![endif]>
注意: 默认的 CSS 样式应该位于 html 文档的首行, 进行条件注释判断的所有内容必须位于该默认样式之后
比如如下代码, 在 IE 浏览器下执行显示为红色, 而在非 IE 浏览器下显示为黑色
- <!-[if IE]>
- <style type="text/css">
- body{
- background-color: #F00;
- }
- </style>
- <![endif]->
来源: https://www.2cto.com/kf/201802/721914.html