html设置段距的方法:1、使用line-height属性,可以设置单行文本的段距,语法“line-height:值;”。2、使用margin属性,可以设置多行文本的段距,语法“margin:间距值;”。

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。
1、使用行高属性:line-height
line-height属性可以对设置段落之间的距离,一般数值越大,段落之间的间距就越大,当然字和字的距离也是变大,很多时候,我们一般不会使用line-height属性来设置。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
p {
line-height: 50px;
}
</style>
</head>
<body>
<p>测试文本,测试文本,测试文本,测试文本,测试文本</p><p><span>立即学习</span>“<a href="https://pan.quark.cn/s/cb6835dc7db1" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">前端免费学习笔记(深入)</a>”;</p>
<p>测试文本,测试文本,测试文本,测试文本,测试文本</p><p><span>立即学习</span>“<a href="https://pan.quark.cn/s/cb6835dc7db1" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">前端免费学习笔记(深入)</a>”;</p>
</body>
</html>效果图:

塔可商城, 一个基于springboot+uniapp+vue3技术栈开发的开源跨平台小程序、管理后台,后端服务的项目,它内置提供了会员分销, 区域代理, 商品零售等功能的新零售电商系统。强大弹性的架构设计,简洁的代码,最新的技术栈,全方面适合不同需求的前端,后端,架构的同学,同时更是企业开发需求的不二选择。 项目结构通过项目结构,你将清楚明白你即将入手的是一个怎么样的项目,你可能需要什么,如何
0
2、使用外边距属性:margin
只要我们设置margin的上下左右边距和对象之间的距离,就可以实现上下段落之间的距离。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
p {
margin: 50px;
}
</style>
</head>
<body>
<p>测试文本,测试文本,测试文本,测试文本,测试文本</p><p><span>立即学习</span>“<a href="https://pan.quark.cn/s/cb6835dc7db1" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">前端免费学习笔记(深入)</a>”;</p>
<p>测试文本,测试文本,测试文本,测试文本,测试文本</p><p><span>立即学习</span>“<a href="https://pan.quark.cn/s/cb6835dc7db1" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">前端免费学习笔记(深入)</a>”;</p>
</body>
</html>
推荐教程:《html视频教程》
以上就是html怎么设置段距的详细内容,更多请关注php中文网其它相关文章!
HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号