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!
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
Richard Nash24,862 Points
What is the bang(!) for at the beginning of the HTML 5 doctype?
Just curious what the bang, which is the exclamation mark, is for in the HTML 5 Document declaration, like this:
It is my understanding that the bang generally means "not", but it must have a different meaning here then? Because this doctype would "not" be an HTML doc...
Just wonderin'... :-)
The exclamation mark is part of the construct for creating a markup declaration back in HTML 4. In HTML 5 it has no role or meaning other than triggering a "standard-mode" in browsers. In the XML Recommendation (XML is what XHTML is based off) it is stated that declaration elements must begin with an exclamation mark. Comments are also declarations and they too begin with an exclamation mark.
What you are thinking of is a boolean negation, which is related to programming. HTML is not a programming language (it's a markup language) so it has nothing to do with that. HTML has changed a lot in the 20+ years of its' existence - what you are seeing is just a remnant of this very evolution. It's just an old practice. :)
It seems to be just some declaration syntax. The following is a pretty good elaboration on it, I thought.
Hope that helps