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 How to Make a Website HTML First Create the Content Containers

Samuel Fils
Samuel Fils
1,392 Points

header and body

What is the reason to add <header> and <body> in code if only <h1>...</h1> alone does the job. Is it for us who are coding to easily view to code organize or does it have some other function. For example <body> <header> <h1>Sam</h1> <h2>Sam</h2> <h3>Sam</h3> </header> </body>

or simply just

<h1>Sam</h1> <h2>Sam</h2> <h3>Sam</h3>

1 Answer

Bryce Santos
Bryce Santos
11,157 Points

The header tag is purely semantic, and just makes code more understandable. As far as I know, after reading up on it, the body tag is not actually needed. Many people do say that it's just expected that you put it there, others say that you don't need it since the browser just automatically reads it like it's there.

Source: https://www.codecademy.com/en/forum_questions/51515bfa1b87eb2d05001995

Samuel Fils
Samuel Fils
1,392 Points

Thanks so much. I have a better understanding now