HTML Basics

HTML Introduction HTML Basic HTML Comments HTML Tags/Elements HTML Attributes HTML Formatting HTML Block and Inline HTML Charsets HTML Classes HTML Colors HTML Div HTML Headings HTML Id HTML Iframes HTML Images HTML File Paths HTML Tables HTML Layout HTML Lists HTML Links <a> HTML Paragraphs HTML Quotations HTML JavaScript HTML Emojis HTML URL Encode HTML Entities HTML Computercode HTML Symbols HTML Styles

HTML Forms

HTML Forms HTML Form Elements HTML Form Attributes HTML Input Attributes HTML Input Regex HTML Input Form Attributes HTML Input Types

HTML SEO

HTML Head HTML Page Title HTML Responsive HTML Semantics HTML Favicon

HTML Graphics

HTML Canvas HTML SVG

HTML Media

HTML Media HTML Audio HTML Video

HTML Reference

a abbr acronym address applet area article aside audio b base basefont bdi bdo big blockquote body br button canvas caption center cite code col colgroup data datalist dd del details dfn dialog dir div dl DOCTYPE dt em embed fieldset figcaption figure font footer form frame frameset h1_-_h6 head header hgroup hr html i iframe img input ins kbd label legend li link main map mark menu meta meter nav noframes noscript object ol optgroup option output p param picture pre progress q rp rt ruby s samp script search section select small source span strike strong style sub summary sup svg table tbody td template textarea tfoot th thead time title tr track tt u ul var video wbr

HTML <sup> Tag

The <sup> tag is used in HTML to define superscript text. Superscript text appears half a character above the normal line of text. It is commonly used for mathematical exponents, footnotes, and annotations.

Here is an example of how the <sup> tag is used:

<p>2<sup>3</sup></p>

Output:

23

In the example above, the number 3 is displayed as a superscript, indicating that it is an exponent of the number 2.

Main Attributes of the <sup> Tag

Attribute Description
style Specifies CSS styles to be applied to the superscript text
class Specifies one or more class names for the element (referring to a class in a CSS stylesheet)

Here is an example of how the <sup> tag can be used with the style attribute:

<p>E=mc<sup style="font-size: 10px;">2</sup></p>

Output:

E=mc2

In the example above, the number 2 is displayed as a superscript with a smaller font size.

Remember to always use the <sup> tag for indicating elements that should be displayed as superscript in your HTML document.