HTML Tags

HTML <sub> Tag

Topic: HTML5 Tags ReferencePrev|Next

Description

The <sub> (short for subscript) tag renders enclosed text as subscript.

Subscript text appears half a character's height below the baseline, and is most often used in mathematical (e.g. y = logax) or chemical formulas, like H2O.

The following table summarizes the usages context and the version history of this tag.

Placement: Inline
Content: Inline and text
Start/End Tag: Start tag: required, End tag: required
Version: HTML 3.2, 4, 4.01, 5

Usage Notes

  • The <sub> tag should be used for typographical reasons only.
  • This tag must not be used for styling purpose like changing the vertical position of the text. In that case CSS should be used instead: the vertical-align property with the sub value will achieve the same effect.

Syntax

The basic syntax of the <sub> tag is given with:

HTML / XHTML: <sub> ... </sub>

The example below shows the <sub> tag in action.

<p>The chemical formula of Water is: H<sub>2</sub>O</p>
<p>The chemical formula of Carbon Dioxide is: CO<sub>2</sub></p>

Tag-Specific Attributes

The <sub> tag doesn't have any specific attribute.


Global Attributes

Like all other HTML tags, the <sub> tag supports the global attributes in HTML5.


Event Attributes

The <sub> tag also supports the event attributes in HTML5.


Browser Compatibility

The <sub> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 3+
  • Apple Safari 1+
  • Opera 4+

Further Reading

See tutorial on: HTML Text Formatting.

Related tag: <sup>.

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties