Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,144 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