class
Summary
Styles all elements with the specified class.
Examples
For example, the following style rule matches any p element whose class attribute has been assigned a space-separated list of values that include the “pastoral” and “marine” class names. This rule matches when class="pastoral aqua marine" but does not match when class="pastoral blue".
<style>
p.pastoral.marine { color: lightseagreen; }
</style>
Notes
Remarks
The class attribute value must immediately follow the “period” (.) notation. More than one class name can be specified in one style rule; to match a subset of class values, each value must be preceded by a period.
Syntax
<strong/>sel.value {...}
Parameters
- sel
- Selector
value - String that specifies the value of the “class” attribute.
Standards information
- CSS 2.1, Section 1.4
Related specifications
- CSS Level 2 Specification
- W3C Recommendation
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]