Paragraph line spacing can be set by the following methods: Using the CSS property line-height Using the HTML tag
Using the line-height attribute in thetag
How to set HTML paragraph line spacing
In HTML, the method to set paragraph line spacing is as follows:
1. Use CSS property
Use CSS property line-height
to set the paragraph line spacing, the unit can be px
, em
, %
or unit less
.
p {
line-height: 1.5em;
}
2. Use HTML tags
Use HTML tags
to create new lines, thus increasing paragraph line spacing.
第一行
第二行
第三行
3. Use the line spacing attribute
In the tag, use the
line-height
attribute to set it directly Paragraph line spacing, the unit can be px
, em
, %
or unit less
.
段落内容
It should be noted that different browsers may have differences in rendering line spacing. If consistent rendering across browsers is required, it is recommended to use the CSS property line-height
.
The above is the detailed content of How to set line spacing in html paragraphs. For more information, please follow other related articles on the PHP Chinese website!