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

Why do we create so many div tags when we're using bootstrap?

I've noticed that Guil Hernandez is creating a lot of div tags when he's making a website. Can we do the same thing he does with less divs? Why are they important? What's the big picture here?

4 Answers

Bootstrap uses divs mainly. In HTML5 we've got some new features such as <article><section> etc. But that doesn't mean that DIV is no longer valid or preferred.

This is how websites are structured, there is no shorter way of implementing this unless you use (Templating System) or in fact, when you start building Dynamic Apps - a lot of things will be generated for you.

Simple websites unfortunately use a lot of divs. (In theory) It's obvious that you need a container (DIV) for every section on your site.

Bootstrap has styled the grid for you, it may sometimes look like there is too many divs in it, but that's their convention and it makes the structure reliable. (And mobile friendly if you get it right)

Your on fire lol :D

Treehouse has helped me with my career. I've got a job as a Back End Developer. I believe that now is the time to give something back, so I'm trying to help others :)

Thats great! I was wondering maybe, do you want to join a slack group where all kind of people are there? from web to apps etc.. ?

We collaborate, or starting to, on projects and so on..

I could send you and invite if you post your email.

Anyone is welcome.

I'm in. Joined as xxquickxx1

The div should only be used if there is no other "more semantically appropriate" element to suit your purpose. This article has some great points on using divs. http://html5doctor.com/you-can-still-use-div/