CSS \9在width属性 [英] CSS \9 in width property
问题描述
这是什么意思?我猜这是一个浏览器的黑客,但我还没有能够找到它到底是什么。
What is the meaning of this? I am guessing it is a browser hack, but I have not been able to find what exactly it does.
width: 500px\9;
\9的意义是什么?
?
推荐答案
\9
Internet Explorer 7,8,& 9。
\9
is a "CSS hack" specific to Internet Explorer 7, 8, & 9.
这只是意味着以 \9;
结尾的CSS的一个特定行代替;
仅在IE 7,8和& 9。
This simply means that the one specific line of CSS ending with a \9;
in place of the ;
is only valid in IE 7, 8, & 9.
在您的示例中,
width:500px \9;
表示宽度为500像素(与 width:500px;
相同的结果)将仅在使用IE 7,8, 9。
width: 500px\9;
means that a width of 500 pixels (same result as width: 500px;
) will only be applied while using IE 7, 8, & 9.
所有其他浏览器将完全忽略 width:500px\9;
,因此不适用<$
All other browsers will ignore width: 500px\9;
entirely, and therefore not apply width: 500px;
to the element at all.
如果你的CSS看起来像这样...
If your CSS looked like this...
#myElement {
width: 300px;
width: 500px\9;
}
结果将是 #myElement
500像素宽,在IE 7,8,& 9,而在所有其他浏览器中, #myElement
将是300像素宽。
The result would be #myElement
500 pixels wide in IE 7, 8, & 9, while in all other browsers, #myElement
would be 300 pixels wide.
http://webdesignandsuch.com/ie9-specific-css-hack/
EDIT:
这个答案是在2011年写的。这个黑客也可以在IE 10中工作。
This answer was written in 2011. It should now be noted that this hack also works in IE 10.
这篇关于CSS \9在width属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!