开发者

What does an asterisk do in a CSS property name? [duplicate]

This question already has answers here: Purpose of asterisk before a CSS property (6 answers) Closed 3 years ago.

I know what an asterisk does in a selector for CSS (What does an Asterisk do?), but what does it do in a property name? Here is an exa开发者_如何学Pythonmple of CSS used by YUI. I don't know what the *display does.

.yui-button .first-child
{
    display:block;
    *display:inline-block;
}


It is a syntax error. So in CSS, it makes the property name invalid and stops it being parsed.

Thanks to bugs in browsers, it is sometimes ignored. This effectively causes the property to apply only to browsers featuring that particular bug — IE7.

In general, it should be avoided in favour of conditional comments.


It's an IE hack. The second declaration will be applied by IE7 and older (thus overriding the first declaration), while other browsers will ignore it and continue applying the first declaration instead.

Also, this is invalid CSS syntax.


its like the underscore for ie6. but for ie7

if you put the asterisk the property will only be used in ie7 and older browsers.

its an hack...


It's one of the IE hacks. Internet Explorer parses CSS in a slightly different way, allowing for certain hacks that will be ignored in other browsers. Google for it. You can target different versions of IE with different hacks.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜