Services Work Learn About Contact
0/8
Lesson 2 of 8

Selectors

A selector tells CSS which HTML element to style. The most common are element selectors, class selectors, and ID selectors.

A class can be used on multiple elements. An ID should be unique to one element. Use a dot (.) for classes and a hash (#) for IDs.

CSS
/* Element selector */
p { color: blue; }

/* Class selector */
.highlight { background: yellow; }

/* ID selector */
#header { font-size: 24px; }
🧠

Quick Quiz

Answer correctly to unlock the next lesson.

Support the mission

This learning platform is 100% free: no ads, no tracking, no paywalls. If it helped you learn something useful, you can support future lessons or donate to Doctors Without Borders, which provides emergency medical care in crisis zones worldwide.

🎉

You completed CSS!

You finished all 8 lessons and quizzes. You now know the basics of CSS.