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 HTML Basics Going Further with HTML Adding Developer Notes with HTML Comments

Darya Zata
Darya Zata
2,562 Points

why put div next to body?

Hello all,

i dont really get it well why we should put div at almost same position as body? I would understand if u put div around a block that u cant identify as f.e. as an article. But why is whole body also a div?

thank U

3 Answers

Matthew Long
Matthew Long
28,407 Points

You're right putting the <div> tag around everything inside the body provides very little benefit. The video was only showing you how a <div> tag works. It is not normally wrapping the entire content inside the body. You'll typically find them wrapping smaller blocks of HTML like you said.

Is that why he mentioned "wrapper div" in stead of just "div"? Just to be sure...

Matthew Long
Matthew Long
28,407 Points

A <div> can be used as a wrapper to wrap elements and style those elements as a group.

Great, thanks.

Kevin Archer
Kevin Archer
2,619 Points

Hi Darya,

I think future lessons go on to illustrate why wrapping everything after <body> in a <div> tag may be helpful when we go on to use CSS with our websites. I'm not quite there yet myself, but I'm almost certain it's mentioned in the lesson!