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

Says my title isnt between <body></body> what am i doing wrong ?

<!DOCTYPE html>
<html>'hey'</html>
<html><head>'to the floor we go'</head><body>'to the river we went'</body></html>
<html><body><p>'My first paragraph!'</p></body></html>

2 Answers

Sergey Podgornyy
Sergey Podgornyy
20,660 Points

Your code structure should be like:

<!DOCTYPE html>
<html>
  <head>
    <title>This is title of a page</title>
  </head>
  <body>
    <p>My first paragraph!</p>
  </body>
</html>

html, head and body tags should be unique on your page. title should be inside head tag.

More about DOM structure you can read here - http://www.w3schools.com/js/js_htmldom.asp or here - http://www.w3schools.com/js/js_htmldom_navigation.asp.

Also you need to know:

  • html is the root node
  • html has no parents
  • html is the parent of head and body
  • head is the first child of html
  • body is the last child of html

Usualy DOM structure looks like:

DOM structure

Jonah Chason
Jonah Chason
5,935 Points

The title element should go inside the head element. The head comes before the body element, right after the html element.

Austin Whipple
Austin Whipple
29,725 Points

Changed your comment to an answer and formatted the code a bit.