欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!

html p与p段落之间有空行间距默认是有定距离,那么这个间距是margin-top和margin-bottom默认值,同时与line-height关连。

1、line-height调整p间距
那么调解p与p上下间距,在line-height配置能够调解排遣。

p{ line-height:30px}

配置了翰墨高低行间距,同时就可斡旋p凹凸间距。

2、margin-top与margin-bottom调整p标签凹凸间距

p{margin-top:10px;margin-bottom:10px}

颠末对p设置装备摆设margin-top和margin-bottom,从而来设置窜改p段落凹凸间距。

3、p高下间距CSS HTML实例

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>p段落上下间距隔绝距离设置装备摆设实例 CSS5</title>
<style>
.abc{ line-height:20px; text-align:left}
.p-a p{ margin-top:30px; margin-bottom:30px}
.p-b p{ margin-top:60px; margin-bottom:60px}
</style>
</head>
<body>
<div class="abc">
<p>第一段</p>
<p>第二段</p>
<p>第三段</p>
<p>第四段</p>
</div>

<div class="abc p-a"> <p>第一段</p> <p>第二段</p> <p>第三段</p> <p>第四段</p> </div>

<div class="abc p-b"> <p>第一段</p> <p>第二段</p> <p>第三段</p> <p>第四段</p> </div> </body> </html>

经过class=p-a和 class=p-b设置margin-top与margin-bottom扭转实现p高下间距设置装备摆设。

 

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/html/h52950.shtml