HTML Tutorial
HTML XHTML
HTML Media
HTML Advanced
Here's a tutorial on HTML document types:
HTML (Hypertext Markup Language) document types are used to specify the version of HTML that a web page is written in. HTML document types are important because different versions of HTML have different syntax and features, and the web browser needs to know which version of HTML a web page is written in to correctly display the content.
The most common HTML document types are:
<!DOCTYPE html>
This document type is placed at the beginning of an HTML document, before the <html>
tag.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
These document types are placed at the beginning of an HTML document, before the <html>
tag.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
These document types are placed at the beginning of an XHTML document, before the <html>
tag.
By specifying the correct HTML document type, you can ensure that your web page is displayed correctly in different web browsers and devices.
HTML document type declaration:
<!DOCTYPE html>
DOCTYPE in HTML:
<!DOCTYPE html> <html> <!-- HTML content goes here --> </html>
HTML5 document type declaration:
<!DOCTYPE html>
Choosing the right DOCTYPE for HTML:
<!-- HTML5 DOCTYPE --> <!DOCTYPE html> <!-- HTML4.01 Strict DOCTYPE --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
HTML DOCTYPE versions:
<!-- HTML5 DOCTYPE --> <!DOCTYPE html> <!-- HTML 4.01 Strict DOCTYPE --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
DOCTYPE and HTML validation:
<!DOCTYPE html>
HTML DOCTYPE and browser compatibility:
<!DOCTYPE html>
HTML DOCTYPE and rendering modes:
<!DOCTYPE html>
Custom DOCTYPE in HTML:
<!DOCTYPE html>
HTML transitional DOCTYPE:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Strict vs. transitional DOCTYPE in HTML:
<!-- Strict DOCTYPE --> <!DOCTYPE html> <!-- Transitional DOCTYPE --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
HTML quirks mode and DOCTYPE:
<!-- No DOCTYPE (quirks mode) --> <html> <!-- HTML content goes here --> </html>
HTML5 DOCTYPE vs. earlier versions:
<!-- HTML5 DOCTYPE --> <!DOCTYPE html> <!-- HTML 4.01 Strict DOCTYPE --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
DOCTYPE in HTML templates:
<!DOCTYPE html> <html> <!-- HTML template content goes here --> </html>
HTML DOCTYPE for mobile:
<!DOCTYPE html>
HTML quirks mode and box model:
<!-- No DOCTYPE (quirks mode) --> <html> <!-- HTML content goes here --> </html>
HTML DOCTYPE and meta tags:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Other meta tags --> </head> <!-- HTML content goes here --> </html>
HTML DOCTYPE and character encoding:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <!-- Other meta tags --> </head> <!-- HTML content goes here --> </html>
HTML5 DOCTYPE example:
<!DOCTYPE html>