totn HTML

HTML: <sup> tag

This HTML tutorial explains how to use the HTML element called the <sup> tag with syntax and examples.

Description

The HTML <sup> tag defines superscript text in an HTML document. For example, when dealing with an area value such as 36 ft2, the number 2 is rendered as superscript. This superscript text has a smaller font and appears with a raised baseline. This tag is also commonly referred to as the <sup> element.

Syntax

In HTML, the syntax for the <sup> tag is:

<body>
  <p>The area of the box is 36 ft<sup>2</sup>.</p>
</body>

Sample Output


Attributes

Only the Global Attributes apply to the <sup> tag. There are no attributes that are specific to the <sup> tag.

Note

  • The HTML <sup> element is found within the <body> tag.
  • The <sup> tag is used to comply with typographical standards or conventions.
  • The <sup> tag is generally used to specify exponents such as m2 and ordinal numbers such as 1st, 2nd or 3rd.

Browser Compatibility

The <sup> tag has basic support with the following browsers:

  • Chrome
  • Android
  • Firefox (Gecko)
  • Firefox Mobile (Gecko)
  • Internet Explorer (IE)
  • Edge Mobile
  • Opera
  • Opera Mobile
  • Safari (WebKit)
  • Safari Mobile

Example

We will discuss the <sup> tag below, exploring examples of how to use the <sup> tag in HTML5, HTML 4.01 Transitional, XHTML 1.0 Transitional, XHTML 1.0 Strict, and XHTML 1.1.