html5 Site Icon CSS3 Site Icon CSS Site Icon

HTML4 Reference

HTML <h1> - <h6> tags

Definition

The <h1> to <h6> tags are used to define the six HTML headings.

Examples


</h1>The daddy of all headings, use sparingly (one per page is a good rule).</h1>

</h2>Use this for section headings.</h2>

</h3>Use this for subsection headings.</h3>

</h4>These headings are generally the same size as normal text</h4>

</h5>These headings are smaller than normal text.</h5>

</h6>This is the smallest heading.</h6>

Required Attributes

NONE

Optional Attributes

align - this attribute is deprecated - use CSS instead.

Common Attributes

class - specifies a classname for the element allowing you to apply the style of the predefined class to the content.


<h2 class="classname">Heading here</h2>

id - specifies a unique id for the element allowing you to apply the style of the predefined id to the content.


<h2 id="idname">Heading here</h2>

style - specifies an inline style for the element allowing you to apply the style to the content.


<h2 style="color:red;text-align:left">Heading here</h2>

title - specifies extra information about the content.


<h2 title="information about the content">Heading here</h2>

Language Attributes

dir - specifies the directional flow of the content.


<!-- The text will flow from left to right -->
<h2 dir="ltr">Heading here</h2>

<!-- The text will flow from right to left -->
<h2 dir="rtl">Heading here</h2>

lang - specifies a language code for the content of the element.


<h2 lang="en">Heading here</h2>

xml:lang - specifies a language code for the content of the element in XHTML documents.


<h2 xml:lang="fr">Heading here<h2>

Document Event Attributes

NONE

Form Event Attributes

NONE

Image Event Attributes

NONE

Keyboard Event Attributes

onkeydown - The JavaScript code to be run when an element is in focus and keyboard key is pressed.


<!-- Executes the go() function -->
<h2 onkeydown="go()">Heading here</h2>

onkeypress - The JavaScript code to be run when an element is in focus and keyboard key is pressed down and released.


<!-- Executes the go() function -->
<h2 onkeypress="go()">Heading here</h2>

onkeyup - The JavaScript code to be run when an element is in focus and keyboard key is released.


<!-- Executes the go() function -->
<h2 onkeyup="go()">Heading here</h2>

Mouse Event Attributes

onclick - The JavaScript code to be run when a mouse is clicked on the element.


<!-- Executes the go() function -->
<h2 onclick="go()">Heading here</h2>

ondblclick - The JavaScript code to be run when a mouse is double clicked on the element.


<!-- Executes the go() function -->
<h2 ondblclick="go()">Heading here</h2>

onmousedown - The JavaScript code to be run when the mouse button is pressed down while the cursor is over the element.


<!-- Executes the go() function -->
<h2 onmousedown="go()">Heading here</h2>

onmousemove - The JavaScript code to be run when the mouse button is moved.


<!-- Executes the go() function -->
<h2 onmousemove="go()">Heading here</h2>

onmouseout - The JavaScript code to be run when the mouse cursor moves off an element.


<!-- Executes the go() function -->
<h2 onmouseout="go()">Heading here</h2>

onmouseover - The JavaScript code to be run when the mouse cursor moves over an element.


<!-- Executes the go() function -->
<h2 onmouseover="go()">Heading here</h2>

onmouseup - The JavaScript code to be run when the mouse button is released while the cursor is over the element.


<!-- Executes the go() function -->
<h2 onmouseup="go()">Heading here</h2>


<frameset> tag    << Prev          Next >>  <head> tag

go to home page Homepage go to top of page Top



HTML Elements

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

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

<!--...-->

<!DOCTYPE>

<a>

<abbr>

<acronym>

<address>

<applet>

<area />

<b>

<base />

<basefont />

<bdo>

<big>

<blockquote>

<body>

<br />

<button>

<caption>

<center>

<cite>

<code>

<col />

<colgroup>

<dd>

<del>

<dfn>

<dir>

<div>

<dl>

<dt>

<em>

<fieldset>

<font>

<form>

<frame />

<frameset>

<h1> - <h6>

<head>

<hr />

<html>

<i>

<iframe>

<img />

<input />

<ins>

<isindex />

<kbd>

<label>

<legend>

<li>

<link />

<map>

<menu>

<meta />

<noframes>

<noscript>

<object>

<ol>

<optgroup>

<option>

<p>

<param />

<pre>

<q>

<s>

<samp>

<script>

<select>

<small>

<span>

<strike>

<strong>

<style>

<sub>

<sup>

<table>

<tbody>

<td>

<textarea>

<tfoot>

<th>

<thead>

<title>

<tr>

<tt>

<u>

<ul>

<var>