Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Selectors Selectors - Beyond the Basics DRY CSS

Aakash Srivastav
seal-mask
.a{fill-rule:evenodd;}techdegree
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 Points

DRY

I am always confused when I should create a new class for an element. Isn't it bad for structure to have many classes? Is it affecting SEO somehow? Where can I read about it?

2 Answers

Jack Weldon
Jack Weldon
1,708 Points

So long as you're using semantic markup SEO doesn't matter to a great extent (Though it can help to label your classes to reflect the content). The only times that I'm aware of where you would not create a class for an element are: The element is relatively simple and doesn't need a class, or you already have a large number of classes that can be used instead of creating a new one - Both of these reflect on how you've written your code and how easy it is to read.

Just go to Facebook, Airbnb or other great sites and hit Ctrl + U;

You'll see the source code with many classes. Don't worry about using many classes for now!