class-id
ID Selector
Selects the single element with the given id attribute value. It has higher specificity than class or type selectors.
#idname Example
#header { background: white; } /* HTML: <header id="header">Top</header> */ ✓ Matches
- <div id="header">Top</div>
- <header id="header"></header>
- <section id="header"></section>
✗ Does not match
- <div class="header"></div>
- <div id="footer"></div>
Browser support
Universal support in all browsers since CSS1.