Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
680 views
in Technique[技术] by (71.8m points)

syntax - What does exclamation point stand for in HTML in constructs like DOCTYPE and comments?

I am curious about the syntax of the doctype and comment tags...

Why the exclamation point? What is it called, what does it mean/do?

I have read through the HTML syntax spec and found no real explanation other than

Any case-insensitive match for the string <!DOCTYPE.

Cite: http://www.w3.org/TR/html-markup/syntax.html#doctype-syntax

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 XML, which is what XHTML is based on, there is no general concept like that. Instead, the character pair <! just appears in some constructs, with no uniform theory.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...