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 element: Is this not redundant?

I understand the need for the document type <!DOCTYPE html> - but I do not understand why the root follows this:

(1) Wouldn't the root, theoretically, come before the document type?

(2) Is the root declaration of <html></html> not a redundant statement after the document type?

Thank you, from a beginner.

1 Answer

The <html> tag tells the browser that this is an HTML document. The <html> tag represents the root of an HTML document. The <html> tag is the container for all other HTML elements (except for the <!DOCTYPE> tag). So basically your HTML tag tells the browser where your other HTML elements will be. And <!DOCTYPE> tells the browser what document it is.