Home >Web Front-end >HTML Tutorial >How to adjust the distance between html paragraphs
In HTML, you can use the CSS properties margin-bottom and margin-top to adjust the spacing between paragraphs: the margin-bottom property sets the bottom spacing of the paragraph, syntax: margin-bottom: [value] (for example, margin-bottom: 10px;) The margin-top attribute sets the top spacing of the paragraph, syntax: margin-top: [value] (for example, margin-top: 5%;)
In HTML, the spacing between paragraphs can be adjusted through the CSS properties margin-bottom
and margin-top
.
margin-bottom
attribute margin-bottom
attribute to set the margin at the bottom of the element, which is the spacing between the element and the element below it . The syntax is as follows:
<code>margin-bottom: [值];</code>
where the value
can be a percentage, pixels or other length units. For example, to set the bottom margin of a paragraph to 10 pixels, you would use the following CSS code:
<code>p { margin-bottom: 10px; }</code>
margin-top
propertymargin-top
The property sets the margin at the top of the element, which is the distance between the element and the element above it. The syntax is the same as margin-bottom
:
<code>margin-top: [值];</code>
For example, to set the top margin of a paragraph to 5%, you would use the following CSS code:
<code>p { margin-top: 5%; }</code>
The above is the detailed content of How to adjust the distance between html paragraphs. For more information, please follow other related articles on the PHP Chinese website!