Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
HTML
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Document type declaration === HTML documents are required to start with a [[document type declaration]] (informally, a "doctype"). In browsers, the doctype helps to define the rendering mode—particularly whether to use [[quirks mode]]. The original purpose of the doctype was to enable the parsing and validation of HTML documents by SGML tools based on the [[document type definition]] (DTD). The DTD to which the DOCTYPE refers contains a machine-readable grammar specifying the permitted and prohibited content for a document conforming to such a DTD. Browsers, on the other hand, do not implement HTML as an application of SGML and as consequence do not read the DTD. [[HTML5]] does not define a DTD; therefore, in HTML5 the doctype declaration is simpler and shorter:<ref>{{cite web |url=https://www.w3.org/TR/html/syntax.html#doctype-syntax |access-date=2013-08-19 |title=The HTML syntax |work=HTML Standard }}</ref> <syntaxhighlight lang="dtd"> <!DOCTYPE html> </syntaxhighlight> An example of an HTML 4 doctype <syntaxhighlight lang="dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "https://www.w3.org/TR/html4/strict.dtd"> </syntaxhighlight> This declaration references the DTD for the "strict" version of HTML 4.01. SGML-based validators read the DTD in order to properly parse the document and to perform validation. In modern browsers, a valid doctype activates standards mode as opposed to [[quirks mode]]. In addition, HTML 4.01 provides Transitional and Frameset DTDs, [[#Transitional versus strict|as explained below]]. The transitional type is the most inclusive, incorporating current tags as well as older or "deprecated" tags, with the Strict DTD excluding deprecated tags. The frameset has all tags necessary to make frames on a page along with the tags included in transitional type.<ref>{{Cite web|title=HTML 4 Frameset Document Type Definition|url=https://www.w3.org/TR/html401/sgml/framesetdtd.html|access-date=2021-12-25|website=W3C}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)