How to set paragraph spacing in html

青灯夜游
Release: 2023-01-06 11:13:17
Original
12001 people have browsed it

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;".

How to set paragraph spacing in html

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>
Copy after login

Rendering:

How to set paragraph spacing in html

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>
Copy after login

How to set paragraph spacing in 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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template