Description
The HTML element <sup> is used to define a superscript text.
The superscript text appears half a character height above the baseline, which is usually used in mathematical and scientific formulas.
- This element should not be used for typographical reasons, meaning just to align or display the content.
- This element should not be used for changing the vertical alignment of a text. Instead, use the CSS property
vertical-align: super;to apply the vertical alignment style.
The below table summarizes its usage.
| Usage Details | |
| Placement | It is displayed as an Inline element. |
| Contents | It can contain Inline elements and text. |
| Tags | Both the opening and closing tags are required. |
| Versions | HTML 3.2, 4, 4.01, 5 |
Syntax
Here is the basic syntax of the <sup> element.
<sup>...</sup>
Examples
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example - HTML Element sup</title>
</head>
<body>
<p>Sample mathematical formula is: y = x<sup>2</sup></p>
<p>Sample scientific formula is: E = mc<sup>2</sup></p>
</body>
</html>
Attributes
The following table shows the list of supported and unsupported attributes for the <sup> element.
| Attribute Type | Details |
| Element-Specific Attributes | The tag <sup> doesn't have any element-specific attributes. |
| Global Attributes | Like all other HTML tags, the tag <sup> supports the HTML Global Attributes. |
| Event Attributes | The tag <sup> also supports the HTML Event Attributes. |
Browser Compatibility
The tag <sup> is supported in all modern browsers.
- Google Chrome 1+
- Internet Explorer or Edge 2+
- Firefox 1+
- Apple Safari 1+
- Opera 4+