css设置段落边框的方法:1、给p元素设置border属性来同时给段落添加上下左右四个边框;2、给p元素设置border-top、border-bottom、border-left、border-right属性来分别给段落添加上下左右边框。
本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。
css设置段落边框
1、使用border属性
<!DOCTYPE html> <html> <head> <style type="text/css"> p{ padding: 10px; border: 1px solid red; } </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> </body> </html>
2、分别使用border-top、border-bottom、border-left、border-right属性
border-top 简写属性,用于把上边框的所有属性设置到一个声明中。
border-bottom 简写属性,用于把下边框的所有属性设置到一个声明中。
border-left 简写属性,用于把左边框的所有属性设置到一个声明中。
border-right 简写属性,用于把右边框的所有属性设置到一个声明中。
<!DOCTYPE html> <html> <head> <style type="text/css"> p{ padding: 10px; border-top: 2px solid red; border-bottom: 2px solid paleturquoise; border-left: 2px solid green; border-right: 2px solid blue; } </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> </body> </html>
(学习视频分享:css视频教程)
以上就是css中段落边框如何设置的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 //m.sbmmt.com/ All Rights Reserved | php.cn | 湘ICP备2023035733号