Hello?
This is a space where I organize what I've learned while studying HTML5. Please note in advance that this is not a place for in-depth postings on specific features.
DTD (Document Type Definition)
This is an abbreviation for Document Type Definition. A DTD is a text file that describes which tags, attributes, and values are valid in a specific HTML document. Each HTML version is said to have its own corresponding DTD. Usually, this is done via a doctype declaration on the first line of an HTML document, which informs the browser which version of HTML or XHTML is being used. If this doctype declaration is omitted, most browsers reportedly fall into a state called "Quirks Mode."
When encountering a page without a doctype declaration, the browser thinks, "Oh, this is a page written a very long time ago," and reaches the conclusion, "Then I should just display it however I want."
If your webpage doesn't look the way you intended in the browser, it is recommended to check the doctype declaration.
Below are the doctype declarations for each version.
HTML5
<!doctype html>
HTML4
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
XHTML 1.0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 1.010 Transitional//EN" "http://www.w3.org/TR/html1/DTD /xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Our attitude toward dealing with IE9 and older versions
1. If you want to make IE8 understand HTML5:
Insert the following code before the </head> tag.
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
By using conditional comments, only IE older than version 9—that is, IE 6, 7, and 8—will understand and apply this code. Interestingly, when I tested it, the script was not included in Chrome. It seems it identifies IE specifically.
2. How to avoid IE 8 Compatibility View and Compatibility View list:
Please put the following code inside your <head>.
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
...
</head>
Linking external style sheets to HTML code
The way to link an external style sheet to a web page is to use the <link> tag.
The following is the usage method for each version.
HTML5
<link rel="stylesheet" href="css/styles.css">
HTML4
<link rel="stylesheet" type="text/css" href = "css/styles.css" >
XHTML 1.0
<link rel="stylesheet" type="text/css" href="css/styles.css" />