HTMLs Tutorial

HTML Tutorial HTML Tags HTML Basic Tags HTML Attributes HTML Elements HTML Formatting HTML Text Format HTML body tag HTML samp tag HTML script Tag HTML section tag HTML select tag HTML source tag HTML span tag HTML strike tag HTML strong tag HTML style tag HTML sub tag HTML summary tag HTML sup Tag HTML svg tag HTML table tag HTML u tag HTML Headings HTML Paragraphs HTML wbr tag HTML Anchor HTML Image HTML Lists HTML Ordered List HTML Unordered List HTML Form HTML Form input HTML with CSS HTML Layouts HTML References HTML Frames HTML Links Fieldset Tag in HTML Basic HTML Tags Br Tag in HTML Free HTML Templates How to Create a Table in HTML HTML Calendar HTML Card HTML Cellspacing HTML Center Image HTML Checkbox Read-only HTML Cleaner HTML Code for a Tab HTML Comment HTML Compiler HTML Nested Forms HTML Overlay Text on the Image HTML Select Option Default HTML Snake Game HTML Subheader HTML Tab Character dd Tag in HTML How Many HTML Tags are There HTML Align Tag HTML Responsive HTML Tab Code HTML Table Alternate Row Color HTML Table Fix Column Width Contact HTML DL Tag in HTML How to Insert Image in HTML HTML Background Color HTML Dark Mode How to Convert HTML to PNG HTML Data Toggle HTML Email Template HTML Font Color HTML Font Family ID and Class in HTML HTML Tab Space HTML Tab Tag HTML Itemprop HTML Itemscope HTML Form Design HTML Input Only Numbers HTML Textarea HTML to JPG HTML to Markdown Python li Tag in HTML MDN HTML What is the Correct HTML for Making a Hyperlink? What is the Root Element of an HTML Document How to Make a Box in HTML How to Save HTML Files in Notepad How to Align Text in HTML How to Change Font Color in HTML? How to Change Font Size in HTML How to Change Image Size in HTML How to Create a HTML Page How to Create a Link in HTML File? How to Create an HTML File? HR Tag in HTML HTML Base Tag HTML Default Attribute HTML Hyperlink HTML Indent HTML Injection Payloads HTML Input Numbers Only HTML Roadmap HTML Row Height HTML Schedule HTML Space HTML Tab HTML vs HTTP HTML5 API HTML5 Video HTML Collection to Array Text Area in HTML

HTML5 Advance

HTML5 Tutorial HTML5 Tags HTML Button Tag HTML canvas Tag HTML caption Tag HTML City tag HTML Tag HTML5 SVG HTML Event Attribute HTML5 Audio HTML5 Youtube HTML5 Button Tag HTML5 Tags

Misc

How to add JavaScript to HTML How to change font in HTML How to change text color in HTML HTML Date HTML Hide Element HTML Nested Table HTML Reset Button What does HTML stand for? HTML Background Image HTML Tag Div Tag in HTML How to insert Image in HTML How to create a link with no underline in HTML How to insert spacestabs in text using HTMLCSS HTML tag HTML Code HTML Tag HTML Canvas Design a tribute page using HTML and CSS What is a Container tag Font tag in HTML Difference between HTML and DHTML Empty Tag in HTML HTML Button Link Html Line Break Img src HTML Nested List in HTML Placeholder in HTML TD in HTML HTML Space Code HTML Target Attribute HTML Tag Markup Meaning in HTML Border-Collapse in HTML HTML Onclick Online HTML Compiler Convert HTML to PDF HTML Formatter HTML5 - Web Storage HTTP – Responses Container Tag in HTML DL Tag in HTML Horizontal Rule HTML HTML Tab Text Html Table Cell Background Color HTML Table Cell Color HTML Col Width How Many HTML Tags are There Convert String to Unicode Characters in Python HTML Runner HTML Style Attribute HTML Superscript Attribute HTML tabindex Marquee Tag in HTML HTML Dynamic Form HTML side Tag HTML Pattern Attribute HTML q Tag HTML Readonly Base 64 Encoding in HTML Documents Enhancing Data Portability and Security Evo Cam Web Cam HTML Free code camp HTML CSS How to Add a JS File in HTML? How to Add Picture in HTML How to Add the Logo in HTML? How to Add Video in HTML HTML Class Attribute HTML Entities HTML Form Elements HTML Form Templates HTML Marquee Tag HTML Radio Buttons HTML Text box HTML to JSX HTML Tooltip Basic HTML Codes How to Align Image Center in HTML HTML Header Tag HTML Image Tag HTML Next Line

HTML Superscript Attribute

To declare a text as a superscript in HTML, use the <sup> tag. A superscript is a smaller-sized text that is displayed half above the standard baseline. For instance, 23, 5th, etc.

The inline text that is to be shown as a superscript for typographical purposes only is specified by the <sup> HTML element. Typically, superscripts are shown with a raised baseline and smaller font.

Attributes 

Only the global attributes are included in this element.

Useful Remarks

The <sup> element should not be used for presentation or appearance alone; rather, it should only be used typographically, i.e., to reposition the text to conform to typographical rules or standards.

For example, instead of using <sup>, CSS (probably vertical-align) should be used to design a company's or product's wordmark that employs an elevated baseline. For example, vertical-align: super or vertical-align: 50% to move the baseline up by 50% may be used to do this.

Use cases that are suitable for <sup> consist of (but are not restricted to):

  1. Presenting exponents like "x3". For this, especially in more complicated situations, it could be worthwhile to take into account using MathML. Look under the Examples below for Exponents.
  • Using higher letters, as several languages do when expressing certain acronyms. For instance, the French term "mademoiselle" can be shortened to "Mlle"; this is a legitimate usage case. For examples, see Superior lettering.
  • The symbol "4th" is used to represent ordinal numbers rather than "fourth." For instance, see Ordinal numbers.

Syntax:

<sup>text</sup>

To utilize the <sup> element, type the content like this: <sup> text </sup> between the opening and closing <sup> tags.

Example:

<p>Class 6<sup>th</sup></p>

Now, this will be rendered as:

HTML Superscript Attribute

Attributes (Global+Event)

The <sup> tag only has global attributes added to it; no particular attributes are present.

NOTE: To adhere to typographical traditions and standards, the <sup> tag, which is the superscript in HTML, is used. The <sup> element is located inside the <body> tag, and it is typically used to show superior writing, exponents, and ordinal numerals.

How can We Utilize the HTML <sup> Tag?

In HTML, the <sup> element is used to display text as a superscript, which is displayed with a smaller font that displays half above the baseline.

Take a2, the 9th

NOTE: The <sup> element should not be used only for presentation or appearance; rather, it should only be used to reposition the text by typographical rules and standards.

Example: Using CSS rather than the <sup> element is the appropriate way to style a product's wordmark that employs text with a raised baseline. Vertical-align:super or Vertical-align:50% might be used for this.

The following is a discussion of valid usage for the <sup> tag, which is not limited to:

  1. Displaying the exponent, like a2.
  2. Displaying excellent lettering. In the past, given names were recorded using abbreviations in English-speaking nations.
  3. For example, in record-keeping, Alexander was referred to by the acronym Alexr.
  4. Displaying ordinal numerals, such as the ninth and the 9th.

Example 1: Exponents

In HTML, superscript is most frequently used to show a number's exponent or power.

<p>Formula for Pythagoras theorem: a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup></p>

Output

HTML Superscript Attribute

Example 2: Outstanding Calligraphy

For HTML superior lettering, use the <sup> element. In the past, names were recorded using abbreviations in English-speaking nations.

<p>We can write coding as Cod<sup>g</sup> for record-keeping</p>

Output:

HTML Superscript Attribute

Example 3: Numbers with Ordinals

Ordinal numbers in HTML are shown using superscript. Numericals shown as superscripts and language-specific text can be used to illustrate this.

<p>Class tenth is written as 10<sup>th</sup></p>

Output:

HTML Superscript Attribute

Use CSS to Set the Superscript Style

Superscripts in HTML may be styled in two different ways with CSS:

  1. Using vertical-align: super
  2. 50% while using vertical-align

Issues with Accessibility

Using the <sup> tag when working with superscripts in HTML raises a few accessibility considerations.

The <sup> element must be used as no method indicates strength (exponent) in HTML. Because the <sup> tag denotes superscript rather than exponent, we cannot expect the browser to read the HTML text 2<sup>3</sup> as "two superscript three" or "two to the power three" when we use a screen reader. If it does, the text in Superior lettering will sound very strange.

Alternatively, using a Unicode equivalent code may represent the numbers in the exponent without the superscript.

Utilizing HTML Superscripts: Do’s and Don'ts

Let's now explore the skill of appropriately employing superscripts with a list of dos and don'ts. 

Take action: Hold onto it readable when used sparingly. Superscripts have the inherent ability to enhance the main points of your writing. Ensuring the superscripted text is still readable is a primary guideline. Even if they are supposed to be somewhat higher and smaller, they shouldn't strain the eyes of your reader. To prevent your superscripts from becoming an annoyance to the reader, make sure you preview your material across a range of devices and screen sizes. This will help you find the ideal balance between style and readability.

Don't Use it too much

Superscripts are fun and offer just the right amount of refinement to your writing. However, it is crucial to utilize this tool cautiously. When used excessively, superscripts may overpower your writing and take attention away from the main story. Use them to draw attention to important details, cite crucial information, or offer more readings, but keep your writing from turning into a superscript maze where the reader becomes disoriented and loses track of the primary argument.

Do: Make Appropriate References with It

Superscripts are one of the most tasteful ways to support scientific facts in your writing with references to books and scholarly publications. Your text will appear more organized and professional if your reference numbers and markers are properly enclosed in superscript tags. This will also help readers find supplementary resources or information without interfering with the story's natural flow. You may use a well-placed superscript to your advantage when creating material that exudes depth and trustworthiness.

Don't: Neglect Regularity

Just like with anything else in content development, consistency in style is essential. Superscripts should always appear in the same way in your writing, whether they are used to indicate footnotes, emphasize a phrase, or illustrate a mathematical equation. The organized display of your material not only establishes a unified appearance but also contributes to the development of a robust brand identity. Whether you're creating a blog post or a website, maintaining a consistent superscript style will help you get a polished and aesthetically attractive result.

Conclusion 

  1. In HTML, a text may be shown as superscript by using the <sup> tag.
  2. By putting a<sup>2</sup> in HTML, we may utilize superscript to render a2.
  3. In HTML, superscripts are frequently used to show ordinals, exponents, and superior letters.