what does \\ mean in a css hex color notation?

匿名 (未验证) 提交于 2019-12-03 02:20:02

问题:

I'm curious what something like this means in CSS:

background-color: #080808 \9; 

I know the hex color notation, of course, but I've never seen \9 used before. Even looking at the w3c, I'm not sure they define it either: color units

回答1:

That's an old Internet Explorer hack

\9 hack WORKS for: IE8 IE8 Standards, IE8 IE7 Standards, IE8 Quirks mode, IE7 Quirks, IE7 Standards (all varieties of IE8), IE6

So, in short, if you want an IE CSS hack that works in all flavors of IE, use the backslash-nine hack.

source



回答2:

2 CSS Rules Specific to Explorer (IE CSS hacks)

Another option is to declare CSS rules that can only be read by Explorer. For example, add an asterisk (*) before the CSS property will target IE7 or add an underscore before the property will target IE6. However, this method is not recommended because they are not valid CSS syntax.

IE8 or below: to write CSS rules specificially to IE8 or below, add a backslash and 9 (\9) at the end before the semicolon. 

Found here. I must give credit to @Zoltan because I didn't know what to google till he posted.

It also has some other examples of IE specific web stuff. Like conditional comments which help when wanting to load things only in IE to handle IE unique cases.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!