HTML tags: sub tag and sup tag

HTML tags: sub tag and sup tag

Today I will introduce two HTML tags that I don’t use very often: the sub tag and the sup tag.
Related article: HTML tags: optgroup, sub, sup, and bdo
Today I will introduce two HTML tags that I don’t use very often: the sub tag and the sup tag.
Definition and Usage:
The <sub> tag defines subscript text. <sup> defines superscript text. They are all inline elements and are slightly smaller than the current font by default.
example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>sub and sup tags in html</title>
<style type="text/css">
* { font-size:12px; font-family:Tahoma}
</style>
</head>
<body>
<div>
This tag is <sub>sub</sub>
This tag is <sup>sup</sup>
</div>
</body>
</html>





learn by analogy:

Let’s see how to achieve this effect with mathematical equations.





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>sub and sup tags in html</title>
<style type="text/css">
* { font-size:12px; font-family:Tahoma}
</style>
</head>
<body>
<div>
x<sub>1</sub> y<sub>2</sub><sup>3</sup>=15
</div>
</body>
</html>
Other applications:
By chance, I discovered that Taobao had made some adjustments to its prices some time ago (I don't know why, but it has been restored now), which is different from the traditional price display in the past.










<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>sub and sup tags in html</title>>
</head>
<style type="text/css">
<!--
body { font:12px/1.8 Tahoma}
span.price { font-family:Arial, Helvetica, sans-serif; font-size:16px; font-weight:700; color:red;}
span.price sub { vertical-align:baseline; font-size:12px;}
span.price sup { vertical-align:text-bottom; color:#555}
-->
</style>
<body>
<span class="price"><sup>¥</sup>43.<sub>26</sub></span>
</body>
</html>
I believe that the application of sub and sup tags is not limited to this. The same is true for other HTML tags. As long as you understand them and mobilize your thinking and imagination, you can use them skillfully and show their unique charm.

<<:  Implementation of adding remark information to mysql

>>:  How to clear floating example code in css

Recommend

How to run nginx in Docker and mount the local directory into the image

1 Pull the image from hup docker pull nginx 2 Cre...

How to use custom tags in html

Custom tags can be used freely in XML files and HT...

A detailed introduction to JavaScript primitive values ​​and wrapper objects

Table of contents Preface text Primitive types Pr...

MySQL query optimization using custom variables

Table of contents Optimizing sorting queries Avoi...

Implementation of HTML sliding floating ball menu effect

CSS Styles html,body{ width: 100%; height: 100%; ...

HTML basic summary recommendation (text format)

HTML text formatting tags 標簽 描述 <b> 定義粗體文本 ...

Ubuntu MySQL version upgraded to 5.7

A few days ago, the library said that the server ...

MySQL query redundant indexes and unused index operations

MySQL 5.7 and above versions provide direct query...

Summary of Ubuntu backup methods (four types)

Method 1: To use respin, follow these steps: sudo...

Detailed explanation of the usage and function of MySQL cursor

[Usage and function of mysql cursor] example: The...

The complete implementation process of Sudoku using JavaScript

Table of contents Preface How to solve Sudoku Fil...

Detailed configuration of wireless network card under Ubuntu Server

1. Insert the wireless network card and use the c...

Various ways to achieve the hollowing effect of CSS3 mask layer

This article introduces 4 methods to achieve mask...

About Vue virtual dom problem

Table of contents 1. What is virtual dom? 2. Why ...