ID Selector
Pattern:
element1#idValue
Description:
ID selector using "hash notation" to refer an ID. ID selector selects elements by its ID value.
The name of the ID value must immediately follow the #. If no element name precedes the octothorpe, then the selector matches all elements containing that ID value.
Examples:
h1#page-title {font-size: 250%;}
body#home {background: silver;}
#example {background: lime;}
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: