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 css sets the line spacing of text

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

Share

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

This article mainly introduces css how to set the line spacing of the text, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

In css, you can use the line-height attribute to set the line spacing of the text. The function of this attribute is to set the distance between lines and adjust the font spacing of each line of text. You only need to add the "line-height: spacing value;" style to the text element; note that the spacing value cannot be negative.

The operating environment of this tutorial: windows7 system, CSS3&&HTML5 version, Dell G3 computer.

In css, the line-height attribute is used to adjust the font spacing (line spacing) per line of text.

The line-height property sets the distance between rows (row height). Note: negative values are not allowed.

Div {border: 1px solid red; margin-bottom: 10px }. Div-a {line-height: 22px} / * css Note: set line spacing line height 22px * / .div-b { Line-height: 40px} / * set line spacing 22px * / I was set line height 22px my line spacing is 22 test text Placeholder content I was set line height 40px I line spacing is 40 test text, placeholder content

Effect picture:

Description: the value that can be set by the line-height property

Number sets the number, which is multiplied by the current font size to set line spacing.

Length sets a fixed spacing between lines.

% is based on the percentage line spacing of the current font size.

Thank you for reading this article carefully. I hope the article "how to set the line spacing of css" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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

*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