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 Use HTML Elements

What is document root?

I didnt understand what is document root. Is it documents body? Please help me

index.html
<!DOCTYPE html>
<html>
  <head>
    <title>Yernar</title>
  </head>

2 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

document root in this case refers to the "root element" of the HTML document. Commonly root element in HTML refers to the

<html>

element of the document, because this element is that the very top of the DOM. The Document Object Model.

Remember,

<!DOCTYPE html>

is your document type definition, but the second time you see html it's your standard html element.

Igor Yamshchykov
Igor Yamshchykov
24,397 Points

Usually document root is the folder that contains the file.

for example if your file is on windows machine under disk C in folder MySite, and the name of the file in that folder is index.html , the document root of index.html will be: C:\MySite

hope that helps