Class and ID Selectors
A class selector starts with a dot and can be reused. An ID selector starts with # and must be unique on a page. Prefer classes for styling.
Example
<style>
.tag { color: #5eead4 } #hero { font-size: 22px; color: #f59e0b }
</style>
<p class="tag">class</p><p id="hero">id</p>Exercise
Symbol for an ID selector.
hero { color: red }Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.