IDs vs Classes in CSS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

IDs vs Classes in CSS

Based on the lesson I just completed, it seems like ID attributes can only be used once per page, while class attributes can be used several times on the same page. Other than that they seem functionally identical. Why would someone ever use ID when class is just more flexible? Are they different in some other way?

25th Mar 2023, 7:27 AM
Ethan Weiss
2 Answers