css上下间距怎么调


本文摘自PHP中文网,作者青灯夜游,侵删。

调整方法:1、使用line-height属性,可以设置行间的距离;2、使用margin-top和margin-bottom属性,可以设置上下外边距;3、使用padding-top和padding-bottom属性,可以设置上下内边距。

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。

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

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

1

p{ line-height:30px}

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

1

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

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

margin-top可以设置元素的顶部外边距,margin-bottom可以设置元素的底部外边距。

3、padding-top和padding-bottom设置段落上下间距

1

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

padding-top可以设置元素的顶部内边距,padding-bottom可以设置元素的底部内边距。

阅读剩余部分

相关阅读 >>

css怎么选择父元素

css input样式怎么修改

css层叠性重要么

html css js 区别是什么

jsp css不起作用怎么办

css中padding是什么意思

css中的display是什么意思

css max-height属性怎么用

css实现加号一个的效果(代码示例)

css如何引入字体文件

更多相关阅读请进入《css》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...