If you find this helpful, please click the Google Button to the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.) |
The <sup> Tag in HTML 5
The <sup> tag creates superscript text. The sup element is one of the phrase elements in HTML. The content of the sup element is displayed above the normal baseline level. The <sub> tag performs a similar function except that the content is displayed below the normal baseline level.
An alternative to the <sup> tag is the vertical-align: super CSS style property. The vertical-align: sub style lowers the applicable content below the normal baseline level.
<sup> Tag Syntax
<body> ... ... phrasing content expected ...<sup>... phrasing content ...</sup> ... </body>
Rules for coding the HTML sup
element
Make sure you understand the difference between a tag and element and are familiar with the definitions of namespace and other HTML terms.
- Code the sup element for superscript text where phrasing content is expected.
- Begin the sup element with a starting <sup> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the
xmlns
attribute on the <html> tag. - Include any HTML global attributes on the <sup> tag as appropriate.
- Inside the sup element, between the starting
<sup>
tag and the ending</sup>
tag, code the inner HTML phrasing content. - End the sup element with a matching
</sup>
closing tag.
Content Model
Content of the sup element
The content of the sup element can include HTML comments, text content and only those HTML tags that can be used in phrasing content.
<sup> Tag Attributes
Attributes of the <sup> tag
global attributes | The only attributes that can be coded on the <cite> tag are the common HTML attributes. |
<sup> Tag Examples
Examples of the sup
tag in HTML 5
Changes in HTML 5 - <sup> Tag
What's new in HTML 5
Differences between HTML 5 and earlier versions of HTML
The 2000-2010 Recommendations from the W3C HTML Working Group defined the HTML namespace for the sup element type name along with the names of all HTML element types. In older (pre-2000) versions of HTML, element type names were not associated with a namespace.