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 Build Structure

maya nelson
maya nelson
300 Points

what purpose does the exclamation mark before DOCTYPE fill?

yeeha.

or is it just there for emphasis/cosmetic purposes?

2 Answers

Michael Fish
Michael Fish
7,804 Points

The beginning of the tag ( <! ) has been around since SGML which was the basis of HTML. In HTML5 it doesn't have any deeper meaning other than letting the browser know it is standard HTML5.

In SGML, which is what HTML was nominally based on, up to and including HTML 4.01, the exclamation mark is part of the construct <!, which is the reference concrete syntax for mdo, markup declaration open. Markup declarations are not markup elements but, informally speaking, declarations relating to elements. This includes document type declaration, comment declarations, and entity declarations.

In HTML5, the HTML syntax has been defined very much in an ad hoc manner, and the doctype string is called just the doctype string – it has no role and no meaning beyond the expected effect of triggering β€œstandards mode” (or β€œno-quirks mode”) in browsers. In the XHTML syntax, it has its XML meaning.