htmlHow to set the paragraph spacing: 1. Use the line-height attribute to set the paragraph spacing of a single line of text, with the syntax "line-height: value;". 2. Use the margin attribute to set the paragraph spacing of multi-line text. The syntax is "margin: spacing value;".
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
1. Use the line-height attribute: line-height
The line-height attribute can set the distance between paragraphs. Generally, the larger the value, the greater the distance between paragraphs. The larger the spacing, of course the distance between words also becomes larger. In many cases, we generally do not use the line-height attribute to set it.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style type="text/css"> p { line-height: 50px; } </style> </head> <body> <p>测试文本,测试文本,测试文本,测试文本,测试文本</p> <p>测试文本,测试文本,测试文本,测试文本,测试文本</p> </body> </html>
Rendering:
2. Use the margin attribute: margin
As long as we By setting the margin's top, bottom, left, and right margins and the distance between objects, you can achieve the distance between the top and bottom paragraphs.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style type="text/css"> p { margin: 50px; } </style> </head> <body> <p>测试文本,测试文本,测试文本,测试文本,测试文本</p> <p>测试文本,测试文本,测试文本,测试文本,测试文本</p> </body> </html>
Recommended tutorial: "html video tutorial"
The above is the detailed content of How to set paragraph spacing in html. For more information, please follow other related articles on the PHP Chinese website!