Class Selector
Pattern:
element1.classname
element1.classname1.classname2
Description:
A class selector uses dot notation to refer a class name. A class selector selects elements by its class name.
The name of the class value must immediately follow the dot. Multiple class values can be chained together. If no element name precedes the dot, the selector matches all elements containing that class value.
Examples:
p.urgent {color: red;}
a.external {font-style: italic;}
.example {background: olive;}
.note.caution {background: yellow;}
Home
HTML CSS Book
CSS Reference
HTML CSS Book
CSS Reference
Selector:
- Universal Selector
- Type Selector
- Descendant Selector
- Child Selector
- Adjacent Sibling Selector
- Class Selector
- ID Selector
- Simple Attribute Selector
- Exact Attribute Value Selector
- Partial Attribute Value Selector
- Hyphen-separated Attribute Value Selector
- !important
Related: