Home  >  Article  >  Web Front-end  >  How to set paragraph spacing in css? The margin property sets paragraph spacing (code example)

How to set paragraph spacing in css? The margin property sets paragraph spacing (code example)

青灯夜游
青灯夜游Original
2018-10-10 11:52:2310968browse

Paragraph spacing is an important factor in web design that improves the article reading experience. But web page layout is not as simple as Word. As web designers, for the sake of a good reading experience for readers, we must reserve a certain amount of space for each subtitle and paragraph of the article, and use CSS to effectively set the paragraph spacing. This chapter will introduce to you how the css margin property sets the paragraph spacing. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

So how to use the css margin property to set the paragraph spacing of text?

css margin can set the spacing distance style between the upper and lower paragraphs. We know margin It is to set the distance between the upper, lower, left, and right objects and the objects. The paragraphs here can also use this css style to achieve spacing.

Below we use a simple code example to explain in detail how to set the css margin property and adjust the spacing between text paragraphs!



	
		
		margin设置段落间距
		
	

第一段,没有设置间距。我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!

第二段,没有设置间距。我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!

第三段,设置了间距。我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!

Rendering:

How to set paragraph spacing in css? The margin property sets paragraph spacing (code example)

In fact, the margin attribute is a shorthand attribute that can set all the margins of the element. You can use the margin attribute to set the margins of the paragraph at the same time. Upper and lower spacing. We can also set the margins one by one, and set the top or bottom spacing of a paragraph. The method is as follows:

margin-top: Set the top margin of the element.

margin-bottom: Set the bottom margin of the element.

Below we will explain the implementation method in detail through simple code examples!



	
		
		margin设置段落间距
		
	

第一段,没有设置间距。我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!

第二段,单独设置上间距。我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!

第三段,没有设置间距。我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!

第四段,单独设置下间距。我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!

第五段,没有设置间距。我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!我是一段测试代码!

Rendering:

How to set paragraph spacing in css? The margin property sets paragraph spacing (code example)

Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study. For more related tutorials, please visit CSS Video Tutorial!

Related recommendations:

php public welfare training video tutorial

How to use padding to adjust paragraph spacing in css? (Code example)

#How to set line spacing in css? Line spacing settings for css text (code example)

#How to set text spacing in css? A simple comparison of word-spacing attributes and letter-spacing attributes

The above is the detailed content of How to set paragraph spacing in css? The margin property sets paragraph spacing (code example). For more information, please follow other related articles on the PHP Chinese website!

Statement:
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