html中p标签的代码,html中上下间距怎么写?

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

1、line-height设置段落上下间距

设置p标签上下间距css代码

p{ line-height:30px}

2、margin-top和margin-bottom设置段落上下间距

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

经由对p标签设置margin-top和margin-bottom,从而来设置段落上下间距。

3、段落上下间距设置实例

< !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>

title 属性规定关于元素的额外信息。这些信息通常会在鼠标移到元素上时显示一段工具提示文本(tooltip text)。

HTML中的title显示的是网页标题标签,可以让浏览者知道当前页面的主要是讲什么的,所以每个网页都应该有一个单独的title。

提示:title 属性常与 form 以及 a 元素一同使用,以提供关于输入格式和链接目标的信息。同时它也是 abbr 和 acronym 元素的必需属性。

html可以使用“color”属性设置字体颜色。;

1、新建html文档,在body标签中添加p标签,然后在p标签中添加一些文字:;

2、在head标签中添加style标签,style标签的作用是为元素添加样式,然后在style标签中添加“p{ } ”,p指的是为所有p标签设置样式,大括号内填写样式内容:;

3、在大括号内添加“color”属性,属性值为文本颜色,这时字体就被添加上了颜色: