CSS ID Selector
Multiple Choice Beginner
Question
How do you select an element with id "header" in CSS?
Hint
ID selectors start with a hash symbol.
Explanation
The ID selector uses a hash (#) prefix. #header selects the element with id="header". IDs must be unique on a page, so this selector matches at most one element. ID selectors have higher specificity than class selectors.
Related Resources
Related Lessons
- CSS Selectors
Learn CSS selectors.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.