Superscript in HTML is created by enclosing the desired text within the <sup> tag. Superscript is especially useful for presenting mathematical exponents or writing ordinal numbers. The default cascading style sheet settings of the superscript tag for most web browsers are "vertical-align:super" and "font-size:smaller".
- Open the HTML file
Open an HTML compatible text file. Web browsers parse HTML in most file types, such as .html, .php and .asp; however, web browsers may ignore HTML in some file types, such as .txt. Make sure the HTML file contains <html> and <body> tags.
- Place text within the tag
Enclose the desired text between <sup> and </sup> inside the <body></body> area. Make sure the ending tag contains a forward slash and each tag is within the less-than and greater-than brackets. Alternatively, superscript may be created using CSS. To do this, add the attribute style="vertical-align:super;font-size:smaller;" to the desired tag. This method, along with additional CSS, allows the superscript to be further customized The following two examples display "st" and "nd" as superscript: 1<sup>st</sup> option. 2<span style="vertical-align:super;font-size:smaller;">nd</span> option.
- Test the result
Navigate to the desired file, and open it with a web browser. If the HTML superscript text does not display, it may not have been entered correctly. Review the code for errors, and ensure other HTML tags are working properly in your web browser.