Skip to content
Related Articles

Related Articles

How to define superscripted text using HTML5 ?
  • Last Updated : 29 May, 2020

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
Recommended Articles
Page :