The vertical-align property specifies the vertical alignment.
When the super or sub value is specified for this property, the text becomes superscript or subscript.
.example {
vertical-align: super;
}
| Property | Value | Explanation |
|---|---|---|
| vertical-align | super | superscript text (raises the text) |
| sub | subscript text (lowers the text) | |
| baseline | aligns to the baseline of the parent element (default) |
<html> <head> <title>TAG index</title> <style type="text/css"> #example1 { vertical-align: super; } #example2 { vertical-align: sub; } </style> </head> <body> <p>Normal text <span id="example1">Superscript text</span></p> <p>Normal text <span id="example2">Subscript text</span></p> </body> </html>
Normal text Superscript text
Normal text Subscript text