- Instant help with your CSS coding problems

Set line spacing in CSS

Question:
How to set line spacing in CSS?
Answer:
line-height: 1.5;  /* Prefered */

line-height: 1.5em;

line-height: 150%;

line-height: 24px;
Description:

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.

The used value is this unitless <number> multiplied by the element's own font size. The computed value is the same as the specified <number>. In most cases, this is the preferred way to set line-height and avoid unexpected results due to inheritance.

 

Share "How to set line spacing in CSS?"
Interesting things
OpanAi's ChatGPT