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 How to Make a Website CSS: Cascading Style Sheets What is CSS?

Chen Wang
Chen Wang
7,371 Points

Why this project do not use the "div" tag?

Is it going to become difficult to manage when it becomes complicated?

I saw most of the website is designed through div+css

2 Answers

Hi Chen,

Managing CSS is not to hard when you use the best practices like DRY (Don't Repeat Yourself).

The only thing with <div></div> is that the on-screen readers don't read them and that you have to give the div either a ID or CLASS for easier selecting.

You should use Semantic HTML Tags as much as possible and make sure that you add descriptions and alt's to your HTML code.

And don't worry to much about it -> the more time you spend learning, writing and testing code the more skilled you'll be with the DRY way.

As they say: "Practice makes Perfect". -> In Web Dev you'll be practising all the time 'till you retire so don't worry too much :)

Not sure if this will add to the answer or confuse the issue, but the 'tags' you use aren't all that relevant. <div> was a generic type tag that basically stood for 'dividing', and HTML5 added more specific semantic tags that do the same thing (dividing sections) with more specific names like header, footer, nav, article, section, etc...

All the same rules regarding ID's, classes, styling etc apply to these new tags that apply to divs. the div term had no special properties associated with it, it was just 'marking' a different section that you could assign an unique ID or different set of classes to the div above it.