属性选择符有四种匹配方式。
例如,如下的属性选择符匹配那些指定了“title ”属性的H1元素,而不论其值为什么?
For example, the following attribute selector matches all H1 elements that specify the "title" attribute, whatever its value.
所以,操作符(operators)和属性选择符(attribute selectors)是一样的。
一个简单选择符或者是一个类型选择符,或者是一个全局选择符,紧跟在后的是零个或多个属性选择符,ID选择符或伪类,次序任意。
A simple selector is either a type selector or universal selector followed immediately by zero or more attribute selectors, ID selectors, or pseudo-classes, in any order.
SimpleXML扩展:探索 SimpleXML工具集,它将XML转换成对象,从而允许通过一般的属性选择符和数组迭代器进行处理。
SimpleXML extension: Explore the SimpleXML toolset that converts XML to an object for you to process with normal property selectors and array iterators.
下面规则中的选择符结合了派生选择符和属性选择符,它匹配任何元素,如果(1)该元素设置了"href"属性;且(2)包含在一个P元素内,而P元素又包含在一个DIV元素内
The selector in the following rule, which combines descendant and attribute selectors, matches any element that (1) has the "href" attribute set and (2) is inside a P that is itself inside a DIV
类选择符选择class属性为特定值的所有元素。
A class selector selects all elements that have a class attribute with a particular value.
下面这个例子,选择符匹配所有指定“class ”属性为“example ”的SPAN元素。
In the following example, the selector matches all SPAN elements whose "class" attribute has exactly the value "example".
与类选择符相似,ID选择符也基于一个属性的值,但这个属性是ID属性。
Like the class, an ID selector is based on the value of an attribute, but in this case, it's the ID attribute.
样式表把属性(可以控制的属性)和值(为这些属性选择的值)与样式选择符联系起来。
The style sheet attaches properties (attributes that you can control) and values (your choices for the attributes) to the style selectors.
这里,选择符匹配那些SPAN元素,其“hello ”属性设置为“Cleveland ”而“goodbye ”属性设置为“Columbus ”。
Here, the selector matches all SPAN elements whose "hello" attribute has exactly the value "Cleveland" and whose "goodbye" attribute has exactly the value "Columbus".
这里,选择符匹配那些SPAN元素,其“hello ”属性设置为“Cleveland ”而“goodbye ”属性设置为“Columbus ”。
Here, the selector matches all SPAN elements whose "hello" attribute has exactly the value "Cleveland" and whose "goodbye" attribute has exactly the value "Columbus".
应用推荐