css – Bang IE7 – 这是什么意思?

这个标题似乎不那么疯狂。我承诺!!

在研究另一个问题时,我注意到Stack Overflow的样式表中有以下内容

...
width: auto;
...
width: 650px!ie7;
padding-bottom: 20px!ie7;
...

这是一种奇怪类型的条件式样式吗?这是一个错误吗?假设它不是一个错误,这是否与所有的IE版本?是否有一种方法来指定一个给定的规则应该只应用于大于 – 说 – 7的IE版本?

我从来没有遇到过这种情况 – 我一直使用条件注释为IE特定的风格(和它的价值,我喜欢保持所有特定于IE的风格完全独立)。

解决方法

我以前听说过,但不是与确切的文本!ie7。

在这里找到一个参考:http://www.javascriptkit.com/dhtmltutors/csshacks3.shtml

!ie

Internet Explorer 7 fixed one of the
issues with the !important identifier,
but it still has problems when the
identifier has an error in it. If an
illegal identifier name is used in
place of important,Internet Explorer
7 and below will handle the property
normally instead of failing.
Therefore,in any style declaration
block,you can include properties
intended to only apply to Internet
Explorer and add an !ie identifier.
Almost any word can be used in place
of ie.

The !ie identifier allows the property
to be applied in IE 7 and below. It
may or may not work in future
versions. Warning: this uses invalid
CSS!

所以,width:650px!ie7;将仅适用于IE 7及以下版本。

实际的文本ie7不是必需的,但它是一个明智的字符串使用,提醒人们背后的目的的黑客。

相关文章

Css3如何实现鼠标移上变长特效?(图文+视频)
css3怎么实现鼠标悬停图片时缓慢变大效果?(图文+视频)
jquery如何实现点击网页回到顶部效果?(图文+视频)
css3边框阴影效果怎么做?(图文+视频)
css怎么实现圆角边框和圆形效果?(图文+视频教程)
Css3如何实现旋转移动动画特效