Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
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