本文摘自PHP中文网,作者醉折花枝作酒筹,侵删。
在html中,可以使用border-bottom设置文本下面有虚线,只需要给文本元素设置“border-bottom:width dashed color”样式即可。设置元素下边框的样式时,只有当这个值不是none时边框才可能出现。

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。
border-bottom 简写属性把下边框的所有属性设置到一个声明中。
可以按顺序设置如下属性:
border-bottom-width
border-bottom-style
border-bottom-color
语法:
1 | border-bottom:width style color;
|
如果不设置其中的某个值,也不会出问题,比如 border-bottom:solid #ff0000; 也是允许的
设置元素下边框的样式时,只有当这个值不是 none 时边框才可能出现。
![1622787791574564.png 9S2}HL2[NB@Y_C0]NUCG3O8.png](http://ypimg.muzhuangnet.com/Collect/csharp/upload/image/571/510/223/1622787791574564.png)
例子:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | < html >
< head >
< style type = "text/css" >
p {
border-style: solid;
}
p.none {
border-bottom-style: none;
}
p.dotted {
border-bottom-style: dotted;
}
p.dashed {
border-bottom-style: dashed;
}
p.solid {
border-bottom-style: solid;
}
p.double {
border-bottom-style: double;
}
p.groove {
border-bottom-style: groove;
}
p.ridge {
border-bottom-style: ridge;
}
p.inset {
border-bottom-style: inset;
}
p.outset {
border-bottom-style: outset;
}
</ style >
</ head >
< body >
< p class = "none" >No bottom border.</ p >
< p class = "dotted" >A dotted bottom border.</ p >
< p class = "dashed" >A dashed bottom border.</ p >
< p class = "solid" >A solid bottom border.</ p >
< p class = "double" >A double bottom border.</ p >
< p class = "groove" >A groove bottom border.</ p >
< p class = "ridge" >A ridge bottom border.</ p >
< p class = "inset" >An inset bottom border.</ p >
< p class = "outset" >An outset bottom border.</ p >
</ body >
</ html >
|
效果:

扩展资料:
border-bottom-color 设置元素的下边框的颜色。
只能定义纯色,而且只有当边框的样式是一个非 none 或 hidden 的值时边框才可能出现。
注释:请始终把 border-style 属性声明到 border-color 属性之前。元素必须在您改变其颜色之前获得边框。
属性值:
推荐学习:html视频教程
以上就是html中文本下面怎么有虚线的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
Html如何嵌套页面?<iframe>标签告诉你答案
Html如何调用外部css
Html 本地存储
Html中h1是什么意思
css写在Html里面吗?
Html和css重难点知识点总结
Html form标签与table标签的区别是什么?这里有说明!
网站对联广告js代码分享
Html5应用:离线的应用以及存储的应用
Html中如何将字体加粗
更多相关阅读请进入《Html》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » html中文本下面怎么有虚线