为组合式,ID和类选择浏览器支持? [英] Browser support for the combined type, ID and class selectors?

查看:120
本文介绍了为组合式,ID和类选择浏览器支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

A type selector matches the name of a document language element type. A type selector matches every instance of the element type in the document tree. For example:

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

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

An ID selector matches an element instance based on its unique identifier.

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

A 类选择的匹配

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

选择器可以在CSS中进行组合:

Selectors can be combined in CSS:

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

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

p.ending { font-style: italic; }

#login.disabled { color: #f00; }

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

My question is, what is browser support (IE6 and up) for the combined type, ID, and class selector?

推荐答案

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

All your given selector combinations are supported in every browser in modern-day use. Including IE6+.

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

The only thing IE6 has trouble parsing is combined class selectors:

.class1.class2

其内容为准类最后进来的链( .class2 在这种情况下),从而使它的任何元素,至少去年的类相匹配。一个例证可以在这对方的回答。

which it reads as whichever class comes last in the chain (.class2 in this case), thereby causing it to match any element with at least that last class. An illustration can be found in this other answer.

这篇关于为组合式,ID和类选择浏览器支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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