Open In App

How to define superscripted text using HTML5 ?

Last Updated : 29 May, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we will set a superscript text by using the <sup> tag. It is used to add a superscript text to the HTML document. The sup tag defines the superscript text. Superscript text appears half a character above the normal line and is sometimes rendered in a smaller font. Superscript text can be used for footnotes.

Syntax:

<sup> Contents... </sup>

Example 1:




<!DOCTYPE html>
<html>
  
<head>
    <title>
        Define a superscript text
    </title>
</head>
  
<body>
    <h2>
        GeeksForGeeks
    </h2>
    <h2>
        How to Define a superscript Text.
    </h2>
      
    <p>
        Geeks<sup>For</sup>Geeks
    </p>
  
    <p>
        Testing <sup>superscript text</sup>
    </p>
</body>
  
</html>


Output:

Example 2:




<!DOCTYPE html>
<html>
  
<head>
    <style>
        sup {
            vertical-align: super;
            font-size: small;
        }
    </style>
</head>
  
<body>
    <h2>
        GeeksForGeeks
    </h2>
  
    <h2>
        HTML5: How to define 
        superscripted text?
    </h2>
  
    <p>
        A sup element is 
        displayed like this:
    </p>
  
    <p>
        This text contains 
        <sup>superscript text</sup>
    </p>
  
    <p>
        Change the default CSS 
        settings to see the effect.
    </p>
</body>
  
</html>


Output:

Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads