The HTML <sub>
element defines a span of text that should be displayed, for typographic reasons, lower, and often smaller, than the main span of text.
Content categories | Flow content and phrasing content |
---|---|
Permitted content | Phrasing content |
Tag omission | None, both the starting and ending tag are mandatory. |
Permitted parents | Any element that can contain phrasing content |
Permitted ARIA roles | Any |
DOM Interface | HTMLElement |
This element only includes the global attributes.
H2O
).vertical-align
property with the sub
value will achieve the same effect.<p>The chemical formula of water: H<sub>2</sub>O</p>
The chemical formula of water: H2O
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of '<sub> and <sup>' in that specification. | Living Standard | |
HTML5 The definition of '<sub> and <sup>;' in that specification. | Recommendation |
<sup>
HTML element that produces superscript. Note that you cannot use them both at the same time and you need to use MathML to produce both a superscript and a subscript next to the chemical symbol of an element, representing its atomic number and its nuclear number.<msub>
, <msup>
, and <msubsup>
MathML elements.
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub