Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is line-height:1?

Tags:

css

It is a question about the appointment of line-height.

I began study of css. line-height: Examples appointing 20px or a unit are often found. It is sometimes line-height: There are 1 and a thing without a unit, but what kind of meaning does this become?

like image 789
freddiefujiwara Avatar asked Jun 16 '09 09:06

freddiefujiwara


People also ask

What does line height 1.5 mean?

line-height: 1.5 (without units) will mutiply the element's font size by 1.5 to compute the line height. line-height: 150% will take 150% of the element's computed font size to compute the line height, which is equivalent to multiply it by 1.5 .

What is a line height?

The line-height CSS property sets the height of a line box. It's commonly used to set the distance between lines of text. On block-level elements, it specifies the minimum height of line boxes within the element. On non-replaced inline elements, it specifies the height that is used to calculate line box height.

What does line height 0 mean?

@BoltClock, line-height: 0 means a minimum line height of 0. I think it is more related to how height: auto is calculated. – youfu. Feb 12, 2016 at 9:30. And height: auto means the height of the content, so the used line height is, evidently, non-zero, and that is what's giving the BCB its height.

What does line height 1.4 mean?

The line-height property in CSS controls the space between lines of text. It is often set in a unitless value (e.g. line-height: 1.4; ) so that it is proportional to the font-size. It's a vital property for typographic control.


2 Answers

Possible Values

number :

Sets a number that will be multiplied with the current font-size to set the distance between the lines

length :

Sets a fixed distance between the lines

% :

Sets a distance between the lines in % of the current font size

take from http://www.w3schools.com/css/pr_dim_line-height.asp

like image 50
Haim Evgi Avatar answered Oct 14 '22 04:10

Haim Evgi


It seems that line-height doesn't need a unit (detailled article).

The property line-height can accept unitless number values. You can also give line-height united values, though generally you shouldn’t. But unitless numbers are just fine for this property.

like image 45
instanceof me Avatar answered Oct 14 '22 04:10

instanceof me