Home > Article > Web Front-end > Getting started with JavaScript sup method (displaying strings as superscripts)_Basic knowledge
The
sup method returns a superscript string defined using the HTML sup tag attribute. Its syntax is as follows:
Tip: This method does not comply with ECMA standards and is not recommended.
sup method example:
Run this example, output:
Change the font text top and bottom alignment (superscript/subscript)
function changFont( x ){
Document.getElementById("sub_title").style.verticalAlign = x;
}
Subscript style Superscript style
Script HouseEvery bit of progress is a solid footprint on our road to success
In this example, JavaScript is used to control the text CSS vertical-align style to dynamically change the upper and lower alignment (superscript/subscript) of the font text.