类选择符选择class属性为特定值的所有元素。
A class selector selects all elements that have a class attribute with a particular value.
仅次于类型选择符最常用的选择符是类选择符。
After type selectors, the most commonly used selectors are class selectors.
可以参考图2,了解HTML、ID和类选择符的css语法。
You can refer to Figure 2 to quickly check the CSS syntax for HTML, ID, and class selectors.
与类选择符相似,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.
现在,我们来看看如何设置类选择符、相关联的类样式定义和html页面以及最后生成的Web显示页面。
Now let's look at how you might set up the class selectors, the associated class style definitions, the HTML page, and the resulting Web-displayed page.
一个简单选择符或者是一个类型选择符,或者是一个全局选择符,紧跟在后的是零个或多个属性选择符,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.
在全局范围使用类的优点是在选择符中不需要使用标记名,只需为类指定样式。
The advantage of using classes globally is that instead of having to marry a given class to that selector, you can simply create a class with a style.
在全局范围使用类的优点是在选择符中不需要使用标记名,只需为类指定样式。
The advantage of using classes globally is that instead of having to marry a given class to that selector, you can simply create a class with a style.
应用推荐