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

Lida Wahdat
Lida Wahdat
400 Points

Doctype tag

It tells me to define the doctype tag. What does that mean?

8 Answers

Hey Lida,

The doctype is required before anything else on the page. It is a short message to the web browser to expect a document type.

For example:

<!DOCTYPE html> tells the browser get ready for some html 5.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> Tells the browser to get ready for some HTML 4.01 Transitional

Check out this link for more info http://www.w3schools.com/tags/tag_doctype.asp

Maximiliane Quel
PLUS
Maximiliane Quel
Courses Plus Student 55,489 Points

at the very top of your html file before any element is set, you define the document type to let the bowser know what version of html you want to use, e.g. html5

this looks like this

<!DOCTYPE html>
Maximiliane Quel
PLUS
Maximiliane Quel
Courses Plus Student 55,489 Points

programming languages are often very sensitive to cases or white space. if you remove the space between it should work just fine.

Maximiliane Quel
Maximiliane Quel
Courses Plus Student 55,489 Points

i.e.

you should have:

<!DOCTYPE html>

instead of

<! DOCTYPE html>
Lida Wahdat
Lida Wahdat
400 Points

This is exactly what I write, but still says the same thing. And thank you for responding. :)

Maximiliane Quel
Maximiliane Quel
Courses Plus Student 55,489 Points

you mean you pressed the check work and next task button but don't get the next question?

Lida Wahdat
Lida Wahdat
400 Points

yes, it says bummer, make sure to define doctype tag

Lida Wahdat
Lida Wahdat
400 Points

<! DOCTYPE html>

Maximiliane Quel
Maximiliane Quel
Courses Plus Student 55,489 Points

the reason it doesn't work is because you have a space between the exclamation mark and the word DOCTYPE.

Lida Wahdat
Lida Wahdat
400 Points

Am I doing something wrong?

Lida Wahdat
Lida Wahdat
400 Points

Hello! Sorry for my late response! Thanks so much for the help! I was able to complete it. Still very new to this. :)