HTML <sub> tag (presentational)S2C Home   « HTML <sub> tag

Definition

The <sub> tag is used for defining subscript text.

Use the CSS vertical-align property for more control.

Example


<sub>This text will be appear lower on the line than normal text.</sub>

Required Attributes

NONE

Optional Attributes

NONE

Common Attributes

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


<sub class="classname">Subscript text here</sub>

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


<sub id="idname">Subscript text here</sub>

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


<sub style="color:red;text-align:left">Subscript text here</sub>

title - specifies extra information about the content.


<sub title="information about the content">Subscript text here</sub>

Language Attributes

dir - specifies the directional flow of the content.


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

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

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


<sub lang="en">Subscript text here</sub>

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


<sub xml:lang="fr">Subscript text here</sub>

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 -->
<sub onkeydown="go()">Subscript text here</sub>

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 -->
<sub onkeypress="go()">Subscript text here</sub>

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


<!-- Executes the go() function -->
<sub onkeyup="go()">Subscript text here</sub>

Mouse Event Attributes

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


<!-- Executes the go() function -->
<sub onclick="go()">Subscript text here</sub>

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


<!-- Executes the go() function -->
<sub ondblclick="go()">Subscript text here</sub>

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 -->
<sub onmousedown="go()">Subscript text here</sub>

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


<!-- Executes the go() function -->
<sub onmousemove="go()">Subscript text here</sub>

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


<!-- Executes the go() function -->
<sub onmouseout="go()">Subscript text here</sub>

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


<!-- Executes the go() function -->
<sub onmouseover="go()">Subscript text here</sub>

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


<!-- Executes the go() function -->
<sub onmouseup="go()">Subscript text here</sub>

go to home page Homepage go to top of page Top