HTML doctype
Contents |
HTML Comment
HTML Declaration is used to define the HTML version.
Syntax
- HTML version 5
<!DOCTYPE html>
Example 1 (For HTML5)
<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <div>TODO write content</div> </body> </html>
Example 2 HTML 4.01 Strict
Contains all HTML elements and attributes, but it does not include presentational or deprecated elements (i.e font). Framesets are not allowed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Example 3 HTML 4.01 Transitional
Contains all HTML elements and attributes, and it is also included the presentational or deprecated element. Framesets are not allowed.
Example 4 XHTML 1.0 Transitional
This requires all makeup must be written in well-formed XML. This declaration includes all HTML elements and attributes and it is also included the presentational and deprecated elements. Framesets are not allowed.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Example 5 XHTML 1.0 Frameset
This is equal to XMTL 1.0 Transitional, but allows the use of frameset content.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
Example 6 XHTML 1.1
This equal to XHTML 1.0 Strict in Example 2, but it allows developer to add module to support for specific languages (i.e East-Asia or African langauge).
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">