Home  >  Article  >  Web Front-end  >  How to display superscript and subscript in html page

How to display superscript and subscript in html page

青灯夜游
青灯夜游Original
2018-12-19 18:04:179372browse

In HTML, you can use the tag and tag to display the superscript and subscript of text.

This article will introduce to you the tag and the tag, so that everyone can have a simple understanding of the tag and the tag. Know that the tag, I hope it will be helpful to you. [Video tutorial recommendation: HTML tutorial]

How to display superscript and subscript in html page

##HTML Tag

The tag is used to define superscript text.

Let’s take a look at how the tag is used through a simple code example:

<p>这是一段测试文本,包含<sup>上标</sup></p>

Rendering:

How to display superscript and subscript in html page

It can be seen that the content contained in will be displayed at half the height of the characters in the current text stream, that is, it will be displayed at half the height of the characters; but will not Will change the font of the included content. The

tag can be used in combination with the tag to create a good hyperlink footnote, for example:

<p>PHP中文网<sup>【<a href="http://www.php.cn/">详情</a>】</sup></p>

Rendering:

How to display superscript and subscript in html page

HTML tag

tag is used to define subscript text.

Let’s take a look at how the tag is used through a simple code example:

<p>这是一段测试文本,包含<sub>下标</sub></p>

Rendering:

How to display superscript and subscript in html page

Similar to the tag, the content in will be displayed at half the character height in the current text stream and will be displayed lower than half the character height; but will not Will change the font of the included content.

Note:

Whether it is the tag or the tag, it can be used in mathematical equations and scientific symbols. and chemical formulas, and are very useful. Example:

<h3>在数学表达式中使用sup标签</h3>	
<p>5<sup>2</sup> + 3<sup>3</sup> = 52</p>
<h3>在数学表达式中使用sub标签</h3>
<p>
	y<sub>1</sub>=20<br>
	y<sub>2</sub>=3<br>
	y<sub>1</sub> - y<sub>2</sub> = 17
</p>

Rendering:

How to display superscript and subscript in html page

Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.

The above is the detailed content of How to display superscript and subscript in html page. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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