为组合式,ID和类选择浏览器的支持?(Browser support for the combine

2019-09-27 16:12发布

A 型选择相匹配的文档语言元素类型的名称。 一个类型选择文档树的元素类型的每一个实例相匹配。 例如:

/* The following rule matches all H1 elements 
   in the document tree:  */
h1 { font-family: sans-serif; }

ID选择基于其独特的标识符的元素实例相匹配。

/* The following rule matches the element whose 
   ID attribute has the value "header":  */
#header { text-align: center; }

类选择匹配

/* The following rule matches all elements 
   with class "money":  */
.money { color: green; }

选择器可以在CSS组合:

h1#chapter1 { font-size: 32px; text-align: center }

p#chapter1.intro { text-align: left }

p.ending { font-style: italic; }

#login.disabled { color: #f00; }

我的问题是,什么是浏览器支持(IE6及以上)为组合式,ID和类选择?

Answer 1:

所有你给定的选择组合在现代日常使用每一个浏览器的支持。 包括IE6 +。

唯一IE6已经麻烦解析进行组合类选择:

.class1.class2

其它的内容为准类是最后在链( .class2在这种情况下),从而导致它任何元件与至少该最后级的匹配。 一个例证可以发现这对方的回答 。



Answer 2:

在这个问题的答案: 一类选择与ID结合

......似乎表明#id.class不工作在IE6



文章来源: Browser support for the combined type, ID and class selectors?