The line – what is the height

The line-height property is used to set the distance between the lines (the line height), which refers to the size of the letter (font size) and the top and bottom edges of the letter (the letter size + the top and bottom margins).

Therefore, the height of a single line of text is determined not by font size, but by line-height.

The line – height method

keywords

line-height: normal;
Copy the code

Depends on the client. Desktop browsers (including Firefox) use the default, which is about 1.2, depending on the font-family of the element.

The length is px and em

<p>udemy</p>

p{
 font-size:20px;
 line-height:30px;
}
Copy the code

Font size is 20 px, line height is 30 px, and white space is 5px.

digital

<p>udemy</p>

p{
 font-size:20px;
 line-height:2;
}
Copy the code

[font = “font-size: 14px”] [font = “font-size: 14px”]

The percentage

<p>udemy</p>

p{
 font-size:20px;
 line-height:200%;
}
Copy the code

Mso-font-kerning: 0pt; mso-font-kerning: 0pt; mso-font-kerning: 0pt;

PS: line-height is inheritable. Setting line-height to an element applies to all children within it