Get the App
SLTechnology News&Howtos  ›  Development  › 

How css sets the line spacing of text

Shulou Source: shulou.com Published: 2022-06-02 16:39:43 11月06日 Update

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!

Tags: Line spacing text attributes interline font article spacing content size number text comment negative value test adjustment value function element interest at the same time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Microsoft Huawei Shulou Technology MySQL