Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does css display superscripts and subscripts of text

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how css displays superscript and subscript of text", the content is simple and easy to understand, and the organization is clear. I hope it can help you solve your doubts. Let Xiaobian lead you to study and learn this article "how css displays superscript and subscript of text".

cssvertical-align attribute

The vertical-align attribute is used to set the vertical alignment of an element. It defines the vertical alignment of the baseline of an element in a row relative to the baseline of the parent element of the element.

The vertical-align property sets the alignment of cell contents in a table; it is compatible with all browsers.

Use text-top, text-bottom attribute values

In the cssvertical-align attribute, set the text-top attribute value to align the top of an inline element with the top of its parent font, and set the text-bottom attribute value to align the bottom of an inline element with the bottom of its parent font.

Here's a simple example of how text-top and text-bottom attribute values set superscript and subscript values for text.

.demo{ font-size:20px; } .superspan{ vertical-align:text-top; font-size:12px; color:red; } .subspan{ vertical-align:text-bottom; font-size:12px; color:red; } A piece of test text with superscript

A test text with subscripts

First use the text-top and text-bottom values of the vertical-align attribute to fix the text within the label relative to its parent element, respectively

The position of the top and bottom of the label text, and then set the font size of the text within the label, you have a superscript or subscript.

Use sub, super attribute values

In the cssvertical-align attribute, set the super attribute value to make the inline element float a certain distance relative to the parent element of the element, forming a superscript of vertically aligned text; and set the sub attribute value to make the inline element sink a certain distance relative to the parent element of the element, forming a subscript of vertically aligned text.

Here's how it works:

.demo{ font-size:20px; } .supspan{ vertical-align:super; color:red; } .subspan{ vertical-align:sub; color:red; } A piece of test text with superscript

A test text with subscripts

The above is "how to display text superscript and subscript css" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report