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

Jong Kim
Jong Kim
6,145 Points

Why don't we just use <body> tag for wrapper rather than <div> tag?

Why don't we just use <body> tag for wrapper rather than <div> tag?

1 Answer

You can use the body tag but remember that body tags is the parent of all elements inside of the body tag that includes your header, main section, and footer. The div tag is use a generic container hence it has no semantic meaning so it is great to serve as a container. To answer it simply using the div element allows you to only place the elements you want inside of that container.

Plus if you if you want your container to be a different color or even add a background image you can while your body element tag can be another shade of color.