The CSS property used to control the spacing between lines of text within an element is the line-height property. It specifies the height of a line box, which is the area that contains a line of text. The line-height property can be used to increase or decrease the spacing between lines of text.
The line-height property can be set to a number, a percentage, or a keyword. A number specifies the height of the line box in terms of the font size. For example, a line-height value of 1.5 will set the height of the line box to 1.5 times the font size. A percentage specifies the height of the line box as a percentage of the height of the containing element. For example, a line-height value of 120% will set the height of the line box to 120% of the height of the containing element. A keyword can be used to set the line height to a specific value. The available keywords are:
normal: The default line height.
single: The line height is equal to the font size.
double: The line height is twice the font size.
initial: The line height is set to its initial value.
inherit: The line height is inherited from the parent element.
The line-height property can be used to control the spacing between lines of text in any element. However, it is most commonly used to control the spacing between lines of text in paragraphs.
Here is an example of how to use the line-height property to increase the spacing between lines of text in a paragraph:
Code snippet
p {
line-height: 1.5;
}
This code will set the line height of all paragraphs to 1.5 times the font size. This will increase the spacing between lines of text, making the paragraph easier to read.
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
The CSS property used to control the spacing between lines of text within an element is the line-height property. It specifies the height of a line box, which is the area that contains a line of text. The line-height property can be used to increase or decrease the spacing between lines of text.
The line-height property can be set to a number, a percentage, or a keyword. A number specifies the height of the line box in terms of the font size. For example, a line-height value of 1.5 will set the height of the line box to 1.5 times the font size. A percentage specifies the height of the line box as a percentage of the height of the containing element. For example, a line-height value of 120% will set the height of the line box to 120% of the height of the containing element. A keyword can be used to set the line height to a specific value. The available keywords are:
The line-height property can be used to control the spacing between lines of text in any element. However, it is most commonly used to control the spacing between lines of text in paragraphs.
Here is an example of how to use the line-height property to increase the spacing between lines of text in a paragraph:
Code snippet
This code will set the line height of all paragraphs to 1.5 times the font size. This will increase the spacing between lines of text, making the paragraph easier to read.