Home > Web Front-end > JS Tutorial > Getting started with JavaScript sup method (displaying strings as superscripts)_Basic knowledge

Getting started with JavaScript sup method (displaying strings as superscripts)_Basic knowledge

WBOY
Release: 2016-05-16 16:33:24
Original
2134 people have browsed it

The

sup method returns a superscript string defined using the HTML sup tag attribute. Its syntax is as follows:

Copy code The code is as follows:

str_object.sup()

Tip: This method does not comply with ECMA standards and is not recommended.

sup method example:

Copy code The code is as follows:


Run this example, output:

Copy code The code is as follows:

Script HouseEvery bit of progress is a solid footprint on our road to success

Tip: This method returns a superscript string defined using the HTML sup tag, even though you cannot directly change the string to a superscript style using this method. If you want to dynamically change the element font to a superscript style, you can refer to the following example:

Change the font text top and bottom alignment (superscript/subscript)

Copy code The code is as follows:



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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template