Matches the class property of the specified element.
Syntax
.value { sRules }
Possible values
value | String that specifies the value of the class attribute. |
sRules | String that specifies one or more cascading style sheet property/value pairs. |
Remarks
The class property value must immediately follow a period (.). 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.
Example
For example, the following style rule matches any H2 element whose class property 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> h2.pastoral.marine {color: lightseagreen;} </style> |
Standards information
This selector is defined in Cascading Style Sheets (CSS), Level 1 (CSS1).