<sub>
<sub>
Tag
The <sub>
tag in HTML defines subscript text, positioning it lower than the baseline of surrounding text. It is frequently used in chemical formulas, mathematical equations, and similar notations.
Syntax
<sub>Subscripted Text</sub>
sub
Demo
Subscript text example:
This text contains subscript text.
This text contains superscript text.
<h1>The sub and sup elements</h1>
<p>This text contains <sub>subscript</sub> text.</p>
<p>This text contains <sup>superscript</sup> text.</p>
Definition and Usage
The <sub>
tag formats text as subscript, placing it slightly below the normal text line and typically reducing its font size. A common example is its use in chemical notations like H₂O.
<sup>
tag.Attributes
- This tag supports all global attributes.
Related Elements
<sup>
– Used for superscript text.- MathML elements like
<msub>
,<msup>
, and<msubsup>
provide advanced mathematical notation. - The CSS vertical-align property can be used to adjust text positioning.
Conclusion
The <sub>
tag is useful for displaying subscript text in scientific, mathematical, and technical content. It ensures proper formatting in cases such as chemical formulas (e.g., H₂O). To create superscript text, the <sup>
tag should be used instead. Both elements contribute to precise content formatting and improved readability.
<strong>
The HTML <strong> element highlights text that is of significant importance, often rendered in bold, to indicate a greater level of emphasis or urgency within the content.
<sup>
The HTML <sup> element formats text as superscript, positioning it above the baseline. This is often used for footnotes, exponents, and mathematical expressions.