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

HTML

Can someone explain to me what the element 'div' does again?

N/A

3 Answers

The <div></div> tag is used in formatting your html code. <div> is usually used to group items in your html together in a container.

div makes a container for you to put stuff in and apply design to

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points

The div element is the main block element that separates one part of an element from another. Like many other elements they're block level and they make full use of the box model. They take a default amount of space on their own but also have default padding, margin and border values.

In HTML5 more specific div elements were released that do the same thing as div but help us create more semantic HTML.

These are Nav, Article, Section, Header and Footer. :-)