|
|
HTML Doctypes
Doctypes
HTML Doctypes are a declaration at the start of your HTML page which tells the browser which version (document type) of HTML you are using. Because HTML has evolved over time, there are a number of different subsets with different rules. Telling the browser and any search engines visiting your page which version of HTML you are using will help them render and spider your content. Add a doctype you your pages as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Document Title</title> </head> <body> Content </body> </html>
What doctypes can I use?
HTML 4.01 StrictThis doctype contains all HTML elements and attributes, but does not include presentational or deprecated elements (like font) which must be included in your CSS. Framesets are not allowed.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> HTML 4.01 TransitionalThis doctype contains all HTML elements and attributes, including presentational and deprecated elements (like font). Framesets are not allowed.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> HTML 4.01 FramesetThis doctype is equal to HTML 4.01 Transitional, but allows the use of frameset content.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> XHTML 1.0 StrictThis doctype contains all HTML elements and attributes, but does not include presentational or deprecated elements (like font) which must be included in your CSS. Framesets are not allowed. Markup must be written as well-formed XML.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> XHTML 1.0 TransitionalThis doctype contains all HTML elements and attributes, including presentational and deprecated elements (like font). Framesets are not allowed. The markup must also be written as well-formed XML.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> XHTML 1.0 FramesetThis doctype is equal to XHTML 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"> XHTML 1.1This doctype is equal to XHTML 1.0 Strict, but allows you to add modules.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
Which doctype should I use?
You should use whichever doctype fits your needs best. Using a strict doctype is best for browsers and spiders (they find it easier to understand), however it can cause you headaches so you may want to use a transitional type while you get the hang of HTML and CSS, then move to a strict type when you understand exactly what you are doing. In the end, the decision is yours.
Page Responses
Currently there have been no responses to this page...
If you have anything to contribute to this tutorial, found a bug, or know a better way of achieving the same goal, please leave your response below.
|