HTML Doctype
It is an information for the browser.
Browser loads correct documents.
<!DOCTYPE>
must be placed at the top of the HTML page.
Learning with HTML Editor "Try it Now"
You can edit the HTML code and view the result using online editor.
The syntax in HTML5
<!DOCTYPE html>
Example
<!DOCTYPE html>
<html>
<head>
<title>Doctype Example</title>
<style>
p{
padding:20px;
background-color:#a0a0a0;
border-radius:5px;
}
</style>
</head>
<body>
<h1>DOCTYPE Example</h1>
<p>It is an information for the browser.<br/>
Browser loads correct documents.<br/>
DOCTYPE must be placed at the top of the HTML page.</p>
</body>
</html>
Click on the "See output" button to see how it works.
The syntax in XHTML 1.1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
<title>XHTML1.1 Example</title>
<style>
p{
padding: 20px;
background-color: #a0a0a0;
border-radius: 5px;
}
</style>
</head>
<body>
<h1>DOCTYPE Example</h1>
<p>It is an information for the browser.<br />
Browser loads correct documents.<br />
DOCTYPE must be placed at the top of the XHTML1.1 page.</p>
</body>
</html>
Click on the "See output" button to see how it works.