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

David Peraza
David Peraza
1,929 Points

Write an Html doctype

I keep typing the right code but for some reason keeps telling me Bummer! Make sure you define the doctype

5 Answers

Justin Horner
STAFF
Justin Horner
Treehouse Guest Teacher

Hello David,

If you would, please provide the code that you are submitting so we can get a better understanding of the problem. For a quick reference to using HTML doctypes check this out.

I hope this helps.

Kazimierz Matan
Kazimierz Matan
13,257 Points

Below is an example. Your doctype declaration should always be the first piece of code in your html document.

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body>
</html>

<!DOCTYPE html> should work fine, there's also a few other variations of Doctypes that specify the version of HTML you're using.

Also, I recommend https://developer.mozilla.org/en-US/ over w3schools. w3schools is a bit buggy, and can teach some bad habits.

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

As an aside I often write my html5 doctyype as html <!doctype html> rather than html <!DOCTYPE html> . The former doesnt; seem to work on treehouse but I don't see that it matters which case you use to write your elements.

Your HTML code sits inside the "body" of the HTML document . Like this (copied from http://www.w3schools.com/html/.....

<!DOCTYPE html> <html> <body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body> </html>

Bookmark the website: www.w3schools.com. I have found it an extraordinary reference, especially when I get stuck.

It didn't copy properly: <!DOCTYPE html> <html> <body>

Your code here

</body> </html>