How to define superscripted text using HTML5 ?

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>

chevron_right


Output:

Example 2:



filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>

chevron_right


Output:

Supported Browsers:

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

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.