Bang IE7 - 这是什么意思? [英] Bang IE7 - What does it mean?

查看:114
本文介绍了Bang IE7 - 这是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个标题似乎不那么疯狂。我保证!

That title isn't quite as crazy it seems. I promise!!

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

While researching for another question, I noticed the following in Stack Overflow's stylesheets:

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

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

Is this an odd type of conditional styling? Is this a mistake? Assuming it isn't a mistake, does this work with all IE versions? Is there a way of specifying that a given rule should only be applied to versions of IE greater than – say – 7?

我从来没有遇到过这个 - ve总是使用针对特定于IE的样式的条件注释(以及为什么它值得,我更喜欢将所有特定于IE的样式完全分开)。

I have never encountered of this before – I've always used conditional comments for IE-specific styles (and for what it's worth, I prefer keeping all IE-specific styles completely separate).

推荐答案

我之前听说过这个,但是没有使用确切的文本!ie7

I have heard of this before, but not with the exact text !ie7.

请参阅此处: http://www.javascriptkit.com/dhtmltutors/csshacks3.shtml


!ie

!ie

Internet Explorer 7修复了
问题之一!important标识符,
,但是当
标识符中有错误时它仍然有问题。如果在
中使用
非法标识符名称重要,Internet Explorer
7及以下将正常处理属性
,而不是失败。
因此,在任何样式声明
块中,您可以包括属性
仅适用于Internet
Explorer并添加!ie标识符。
几乎任何单词都可以用于
of 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.

属性
应用于IE 7及以下版本。它
可能或不会在未来工作
版本。警告:这使用无效的
CSS!

因此, width:650px!

So, width: 650px!ie7; will be applied in only IE 7 and below.

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

The actual text ie7 is not required, but it's a sensible string to use, to remind people of the purpose behind the hack.

这篇关于Bang IE7 - 这是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆