html5 Site Icon CSS3 Site Icon CSS Site Icon

HTML5 Reference

HTML5 <!DOCTYPE> declaration

Definition

The <!DOCTYPE> declaration is not a HMTL tag but it informs the browser about which version of HTML/XHTML we are using.

The <!DOCTYPE> declaration must be the first entry in any HTML page and must come before the opening <html> tag.

Example



<!DOCTYPE html>
<html>
<!-- The Basic Structure of a HTML document follows -->
<!-- Everything goes between the start and end HTML tags. -->
 

<head>
<!-- The header contains meta information pertaining to the HTML document as well 
as a title and other stuff we will discuss in HTML4 Intermediate/Advanced lessons.
External files such as CSS stylesheets and JavaScript files can also imported in
the header section of our HTML file. -->

  <title>A Title which will appear in the Windows title bar.</title>
</head>

<body>
<!-- The content of the web page appears in the body section. -->

</body>

<!-- We complete the HTML file with the closing HTML tag. -->
</html>

HTML Doctypes Available From the W3C Recommendations for HTML5 and HTML 4.01

HTML5

There is only one <!DOCTYPE> declaration in HTML5


<!DOCTYPE html> 

HTML 4.01

The older HTML 4.01 specifcation has different <!DOCTYPE> declarations depending on what DTD you want to use and are shown below:

HTML 4.01 Frameset

Contains all HTML elements.
Framesets are allowed by this DTD.


<!DOCTYPE html PUBLIC "-//W3C//DTD 4.01 Frameset//EN"  
         "http://www.w3.org/TR/html4/frameset.dtd"> 

Use this if for some strange reason you want to use frames and you turn into a werewolf on a full moon.
Not Recommended.

HTML 4.01 Transitional

Contains all HTML elements INCLUDING deprecated and presentational elements.
Framesets are not allowed by this DTD.


<!DOCTYPE html PUBLIC "-//W3C//DTD 4.01 Transitional//EN"  
         "http://www.w3.org/TR/html4/loose.dtd"> 

Generally used for legacy code where deprecated elements are still used.

HTML 4.01 Strict

Contains all HTML elements EXCLUDING deprecated and presentational elements.
Framesets are not allowed by this DTD.


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"  
         "http://www.w3.org/TR/html4/strict.dtd"> 

If you wanna use HTML instead of XHTML, then this is the baby for you.
Recommended.

XHTML Doctypes Available From the W3C Recommendations

XHTML 1.0 Frameset

Contains all HTML elements.
Framesets are allowed by this DTD.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"  
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> 

Use this if for some strange reason you want to use frames and you still believe in the tooth fairy.
Not Recommended.

XHTML 1.0 Transitional

Contains all HTML elements INCLUDING deprecated and presentational elements.
Framesets are not allowed by this DTD.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

Generally used for legacy code where deprecated elements are still used.

XHTML 1.0 Strict

Contains all HTML elements EXCLUDING deprecated and presentational elements.
Framesets are not allowed by this DTD.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 

For XHTML this is supported in all browsers.

XHTML 1.1

Contains all HTML elements EXCLUDING deprecated and presentational elements.
Framesets are not allowed by this DTD.
Allows the use of modules.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"  
         "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 

The newest version of XHTML, but not supported in all browsers.

<!DOCTYPE> Specific Attributes

N/A

Global Attributes

N/A

Event Attributes

N/A



<!--...--> tag    << Prev          Next >>   <a> tag

go to home page Homepage go to top of page Top

HTML5 Elements

The complete set of HTML5 elements also known as HTML5 tags from the latest HTML5 Specification.

Click the links for more information on individual tags and their attributes.

<!--...-->

<!DOCTYPE>

<a>

<abbr>

<address>

<area>

<article>

<aside>

<audio>

<b>

<base>

<bdi>

<bdo>

<blockquote>

<body>

<br>

<button>

<canvas>

<caption>

<cite>

<code>

<col>

<colgroup>

<datalist>

<dd>

<del>

<details>

<dfn>

<dialog>

<div>

<dl>

<dt>

<em>

<embed>

<fieldset>

<figcaption>

<figure>

<footer>

<form>

<h1> - <h6>

<head>

<header>

<hr>

<html>

<i>

<iframe>

<img>

<input>

<ins>

<kbd>

<keygen>

<label>

<legend>

<li>

<link>

<main>

<map>

<mark>

<menu>

<menuitem>

<meta>

<meter>

<nav>

<noscript>

<object>

<ol>

<optgroup>

<option>

<output>

<p>

<param>

<pre>

<progress>

<q>

<rp>

<rt>

<ruby>

<s>

<samp>

<script>

<section>

<select>

<small>

<source>

<span>

<strong>

<style>

<sub>

<summary>

<sup>

<table>

<tbody>

<td>

<textarea>

<tfoot>

<th>

<thead>

<time>

<title>

<tr>

<track>

<u>

<ul>

<var>

<video>

<wbr>