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 Treehouse Club: HTML Publish a Story HTML Structure

Michael Bianco
Michael Bianco
1,194 Points

I understand that u need to declare the document type w <!DOCTYPE html> but why do you include html twice under it?

If <!DOCTYPE htlm> signifies that you are going to be making html stuff, why directly under do you write html twice?

<!DOCTYPE html>
<html> </html>

2 Answers

Rick Gleitz
Rick Gleitz
45,778 Points

Between those two tags is where all your HTML formatted code is going to go. Think of it as the code's way of telling the browser that what follows is to be interpreted/rendered using the HTML language, as opposed to other formats for displaying in the browser.

There were many versions of the HTML language prior to HTML5 and they were rendered different ways by the browser. The standard is now HTML5 and that first line informs the web browsers that what follows is to be rendered as HTML5. HTML5 added many new tag types that previously didn't exist and without the DOCTYPE line, there is a chance your page will not render properly if you use these newer features.