HTML sub
Created By: chatGPT
HTML sub is a tag used to define subscript text in documents. Subscript text appears lower than the baseline of the surrounding text, making it useful for formulae and chemical symbols, among other things. The
<sub>
tag is straightforward, and using it correctly can enhance the readability and professionalism of your web content.<p>This is normal text, and this is <sub>subscript</sub> text.</p>
When using the
<sub>
tag, it is important to enclose the text that you want to appear as a subscript within the opening and closing <sub>
tags. This ensures that only the designated text is affected.<p>H<sub>2</sub>O is the chemical formula for water.</p>
You can easily style the subscript text using CSS if needed. This allows you to change the color, font, or other styles to fit the design of your website.
<style>
sub {
color: blue;
font-size: smaller;
}
</style>
<p>This is a styled <sub>subscript</sub> example.</p>
Here is another example where we include both subscript and normal text together in a sentence. It’s a straightforward implementation that can be repeated throughout your HTML document whenever necessary.
<p>The formula for sulfuric acid is H<sub>2</sub>SO<sub>4</sub>.</p>