Create HTML <sup> or <sub> Tags Online
The Superscript and Subscript HTML Generator creates either a <sup> or <sub> element and shows it beside normal baseline text. The
HTML Standard
reserves these elements for cases where the raised or lowered position carries meaning, such as an exponent, ordinal, footnote marker, chemical formula, or indexed variable.
Superscript and Subscript Generator Options
- Type selects a superscript
<sup>or subscript<sub>element. - Text sets the plain-text content placed inside the selected element.
The fixed normal text in the preview provides a baseline for comparing the selected element. Characters with special meaning in HTML are escaped, so entered markup is displayed as text rather than interpreted as nested HTML.
Create HTML <sup> or <sub> Tags in C#
The C# panel shows how to reproduce the current output with Aspose.HTML for .NET . The generated code follows this workflow:
- Create an
HTMLDocumentand add the normal baseline text. - Create an
ElementnamedsuporsubwithCreateElement(). - Assign the entered value through
TextContent. - Add the element with
AppendChild()and write the document withSave().
Select the required text position first, then copy the updated C# code into your .NET project.
Superscript and Subscript HTML Generator FAQ
1. When should I use sup instead of sub?
Use <sup> for meaningful raised text such as exponents, ordinals, or footnote markers. Use <sub> for meaningful lowered text such as chemical indices or subscripts in a family of variables.
2. Should sup and sub be used only to move text vertically?
No. These elements are intended for typographical conventions whose position contributes to meaning. For a purely decorative vertical shift, use CSS on a neutral element instead of assigning superscript or subscript semantics.
3. Does a sup element automatically create a footnote?
No. <sup> only marks the raised content. A working footnote marker also needs a link to the note, a corresponding target, and navigation that lets the reader return to the original position when appropriate.
4. Are sup and sub suitable for complex mathematical formulas?
They work for short expressions such as an exponent or variable index. Use MathML when a formula needs fractions, roots, operators, structured relationships, or richer mathematical accessibility.
5. How do I place the generated tag inside a formula or word?
Copy the generated <sup>...</sup> or <sub>...</sub> fragment and insert it at the required inline position, for example x<sup>2</sup> or H<sub>2</sub>O. The fixed normal text shown by the generator is only a baseline for the preview.
Get Started with Aspose.HTML for .NET API
Install Aspose.HTML for .NET from NuGet with the .NET CLI:
dotnet add package Aspose.HTML
You can also use the NuGet Package Manager UI or run Install-Package Aspose.HTML in the Package Manager Console. See the
installation guide
for setup details, or request a
temporary license
to evaluate the API without evaluation limitations.
Other Supported HTML Generators
Create and preview markup for other common HTML elements.