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如何去除边框

css3做出多样边框特效

css实现元素隐藏和显示的属性有哪些

css优化策略介绍

html与css中2d转换模块

css里怎样调节字体颜色

css怎么设置字体大小

css如何设置边框

什么是css样式层叠表

css box-flex属性怎么用

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




打赏

取消

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

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

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

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

评论

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