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 trialJack Pirone
202 PointsI Still Don't Know Why You Have to Do <DOCTYPE! html>?
If You Know Please Help(Also, If You Know Where The Instructors get The Stickers They Put on There computers,please tell me)
3 Answers
Stone Preston
42,016 Pointsfrom the W3
Why specify a doctype? Because it defines which version of (X)HTML your document is actually using, and this is a critical piece of information needed by some tools processing the document.
For example, specifying the doctype of your document allows you to use tools such as the Markup Validator to check the syntax of your (X)HTML. Such tools won't be able to work if they do not know what kind of document you are using.
But the most important thing is that with most families of browsers, a doctype declaration will make a lot of guessing unnecessary, and will thus trigger a "standard" rendering mode.
haunguyen
14,985 PointsYou declare <DOCTYPE! html> at the top of your html page so that the browser knows how to parse the codes/tags.
This particular declaration is the formal declaration to let the browser know that you are using HTML5 syntax in your code. The browser companies agreed that the word "html" means HTML5.
In the past, you declare the actual HTML version (like html4 / html3 ... or something like that).
I guess from now on, "html" mean the latest html version that the browser can handle.
As to why you have to declare html? because the browser can also display other types of documents such as JSON/txt/...
Jack Pirone
202 PointsThanks
Jack Pirone
202 PointsThanks Ken, Stone Preston, and haunguyen
Ken Alger
Treehouse TeacherKen Alger
Treehouse TeacherJack;
While not all of the stickers are available, a great place to look is at devswag.com for similarly related items.
Happy coding and welcome to Treehouse!
Ken