HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<sub> (Subscript)


This element renders its content as subscripted text.

Standard Syntax


<sub
class="class name(s)"
dir="ltr | rtl"
id="unique alphanumeric string"
lang="language code"
style="style information"
title="advisory text"
</sub>

Attributes Defined by Internet Explorer


accesskey="key" (5.5)
contenteditable="false | true | inherit" (5.5)
disabled="false | true" (5.5)
hidefocus="true | false" (5.5)
language="javascript | jscript | vbs | vbscript" (4)
tabindex="number" (5.5)
unselectable="on | off" (5.5)

Standard Event Attributes


onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup

Events Defined by Internet Explorer


onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onselectstart, ontimeerror

Example


Here is some <sub>subscripted</sub> text.
The secret formula is X<sub><small>2</small></sub>

Compatibility


HTML 3.2, 4, and 4.01, XHTML 1.0
Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7

Notes


The HTML 3.2 specification supports no attribute for <sub>.

The <sub> tag is removed from XHTML 1.1 since it can be created using the CSS property vertical-align.

Most browsers may slightly shift text lines below a <sub> tag.

(X)HTML Elements
CSS Properties
Previous: style Next: sup
< Home | About | Chapters | Examples | Errata | Reference | Site Map >