您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

html怎么设置段距

2025/4/4 12:01:31发布21次查看
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>测试文本,测试文本,测试文本,测试文本,测试文本</p> </body></html>
效果图:
2、使用外边距属性:margin
只要我们设置margin的上下左右边距和对象之间的距离,就可以实现上下段落之间的距离。
<!doctype html><html> <head> <meta charset="utf-8"> <style type="text/css"> p { margin: 50px; } </style> </head> <body> <p>测试文本,测试文本,测试文本,测试文本,测试文本</p> <p>测试文本,测试文本,测试文本,测试文本,测试文本</p> </body></html>
推荐教程:《html视频教程》
以上就是html怎么设置段距的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product