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 to use text attributes in CSS

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

CSS text attribute use method, for this problem, this article details the corresponding analysis and solution, hoping to help more want to solve this problem of small partners to find a simpler and easier way.

text-indent

Value: Length value (positive or negative)

Example: p {text-indent:3em;}

letter-spacing

Value: Any length value (positive or negative).

Example: p {letter-spacing:.2em;}

word spacing

Value: Any length value (positive or negative).

Example: p {word-spacing:.2em;}

Text decoration text-decoration

Values: underline, overline, line-through, blink, none.

Example: .retailprice {text-decoration:line-through;}

text-align

Values: left, right, center, justify

Example: p {text-align:right;}

line height

Value: Any numeric value (no units specified)

Examples:

CSS Code Copy content to clipboard

p {line-height:1.5;}

Description:

Line heights in CSS are evenly distributed above and below a line of text. For example, if the font size is 12 pixels and the line height is 20 pixels, the browser adds 4 pixels of white space above and 4 pixels below the text to make up the 20 pixel line height.

The easiest way to modify the default line height is to use the font shortcut attribute to write the font-size and font-height values together in the form of compound values, such as div#intro {font: 1.2em/1.4 helvetica, arial, sans-serif;} The line height above is 1.4 times the font size of 12em. Note that there is no need to specify units for the line-height z value, just a numerical value.

text-transform

Values: none, uppercase, lowercase, capitalize.

Examples:

CSS Code Copy content to clipboard

p {text-transform:capitalize;}

Note: Capitalize capitalizes the first letter of each word, an effect common in many ad, newspaper, and magazine headlines.

vertical-align

Value: arbitrary length value and sub, super, top, middle, bottom, etc.

Examples:

CSS Code Copy content to clipboard

span {vertical-align:60%;}

Description:

Vertical-align moves text up and down with reference to the baseline, but this property affects only inline elements.

If you want to align block-level elements vertically, you must set their display property to inline.

This attribute is more commonly used as a superscript in a formula or chemical formula, or as a subscript in a footnote in text.

HTML tags and have default superscript and subscript styles, but resetting the vertical-align and font-size attributes can make them look better. For example: p.custom {font-size:.8em; vertical-align:1em;}

About CSS text attributes in the use of the answer to the problem shared here, I hope the above content can be of some help to everyone, if you still have a lot of doubts not solved, you can pay attention to the industry information channel to learn more related knowledge.

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