HTML HTML Tutorial HTML Forms HTML Graphics HTML Media HTML APIs HTML Tags



HTML Tag: sup

The HTML tag sup is used to define superscript text. Superscript text is a smaller font size and is positioned above the normal text line. This tag is commonly used for mathematical equations, chemical formulas, and footnotes.

The sup tag is an inline element that is used to format text in a superscript style. It is commonly used to display mathematical equations, chemical formulas, and footnotes. The tag is used to indicate that the text enclosed within it should be displayed in a smaller font size and positioned above the normal text line. This tag is often used in conjunction with the sub tag, which is used to define subscript text.

The sup tag can be used with any text content, including letters, numbers, and symbols. It is important to note that the sup tag does not change the meaning of the text, but rather only changes its appearance. This means that the text enclosed within the sup tag should still be semantically correct and meaningful.

Here are some examples of how the sup tag can be used:

Example 1: Superscript Text

The following code will display the text "E=mc2" with the "2" in superscript:

  
    E=mc2
  

Output: E=mc2

Example 2: Footnote

The following code will display a footnote with the text "This is a footnote" in superscript:

  
    This is some text1
    ...
    

Footnote: This is a footnote

Output: This is some text1

Footnote: This is a footnote

Example 3: Chemical Formula

The following code will display the chemical formula for water with the "2" in superscript:

  
    H2O
  

Output: H2O

Example 4: Mathematical Equation

The following code will display the mathematical equation for the area of a circle with the "2" in superscript:

  
    A = πr2
  

Output: A = πr2

Activity