IE条件语句IE hack大全
2014-08-11来源:

Conditional comments work as follows:

代码如下:

[code]

Their basic structure is the same as an HTML comment (). Therefore all other browsers will see them as normal comments and will ignore them entirely.

IE, though, has been programmed to recognize the special

According to the conditional comment this is not IE

Note the special syntax:

gt: greater than

lte: less than or equal to

Also note the last one. It has a different syntax, and its contents are shown in all browsers that are not IE:

代码如下:

CSS hack?

Are conditional comments CSS hacks? Strictly speaking, yes, since they can serve to give special style instructions to some browsers. However, they do not rely on one browser bug to solve another one, as all true CSS hacks do. Besides, they can be used for more than CSS hacks only (though that rarely happens).

Since conditional comments are not based on a browser hack but on a deliberate feature I believe they are safe to use. Sure, other browsers could implement conditional comments, too (though as yet none have done so), but they're unlikely to react to the specific query

更多信息请查看IT技术专栏

2026上岸·考公考编培训报班

  • 报班类型
  • 姓名
  • 手机号
  • 验证码
推荐信息
Baidu
map