The paragraph in the DIV+CSS layout uses the <p> label, and the margin label defines the style for the upper and lower margins of the paragraph (indentation). Margin is defined as the top, bottom, left, and right four directions, and normally we can use one line to describe the style we need.
Example: margin:20px 8px 8px 20px;
This sentence is expressed separately: Margin-top;margin-right;margin-bottom;margin-left.
The order of the four values is: top, right, bottom, and left. It's the clockwise direction starting 12:00.
How the values are consistent and the values are the same, we can optimize them again.
Can be written as: margin:20px 8px;
This sentence is divided into: up and down, around.
For the text alignment within the paragraph, generally use text-align, such as: Text-align:center;
The following are examples of different paragraph layouts:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>www.bianceng.cn - 编程入门网</title>
<style type="text/css">
<!--
div {
width:500px;
background:#ccc;
}
p {
border:1px solid red;
background:#fff;
}
#p1 {
margin: 20px 8px 8px 20px;/*上。右。下。左*/
text-align:center;
}
#p2 {
margin: 20px 8px;/*上下。左右*/
text-align:right;
}
#p3 {
margin: 20px;/*四边均是*/
text-align:left;
}
-->
</style>
<body>
<div>
<p id="p1">jzxue.com - Div CSS布局 段落布局方法</p>
<p id="p2">jzxue.com - Div CSS布局 段落布局方法</p>
<p id="p3">jzxue.com - Div CSS布局 段落布局方法</p>
</div>
</body>