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 Structuring Your Content Grouping Content with <main> and <div>

Anmol Bajaj
Anmol Bajaj
5,556 Points

Do we still need to use <div> with <body> ? Or is it just an old practice It was recommended in the video.

In the video it was instructed to use <div> with the <body> . I just want to know the main reason, why it was asked .

5 Answers

You will always create elements inside your <body> tag, the body tag simply declares the beginning of the core content of the page.

riley brown
riley brown
11,645 Points

Yes divs are good for grouping / dividing content and styling them with css

pet
pet
10,908 Points

You don't have to use <div> tags, they just section up your code. You can make your own tags, for sectioning your code, but they don't do anything special.

Michael Pashkov
Michael Pashkov
22,024 Points

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div

generic container, it's used to group content so it can be easily styled using the class or id attributes.

Deividas Paulauskas
Deividas Paulauskas
3,661 Points

Divs will be your best friends when styling your page.