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 styling questions

So, I’m just curious about this...

Is it frowned upon to put styling on nested divs rather than the parent divs? For example, giving a child div a font-family property rather than the parent div?

Also, I tend to rely on class names rather than ID’s, using ID’s for sections, and class names for everything else (including navigation menus), for example? Even though there’s one of each.

1 Answer

Óscar Hernández sandoval
Óscar Hernández sandoval
9,257 Points

You should use class name in your html as img, a tags , span, and divs for sections, articicles, asides etc.