css怎么在文字两边加上横线CSS怎么在文本两侧添加水平线,在css中,可以使用:before、after和content属性在文本两侧添加横线;语法“e:在前,e:在后{内容:“”;flex :1 1;border-bottom:2px实心;} “,e是包含文本的元素。
教程: windows 7系统操作环境,css3版本,戴尔G3电脑。
教程推荐:css视频教程
css在文字两边加上横线的方法
在css中,可以通过使用:before、after选择器和内容属性来实现。
:before选择器在所选元素之前插入内容,after选择器在所选元素之后插入内容。
内容属性与:before和:after伪元素结合使用,以插入生成的内容。
示例:
!声明文档类型
超文本标记语言
头
meta charset=’utf-8 ‘
风格
h4 {
display: flex
flex-direction : row;
}
h 4:之前,
h4:after {
content :“”;
flex: 1 1
border-bottom : 2px solid # 000;
margin: auto
}
img {
height: 100px
宽度: 100 px;
边界半径:50%;
}
/style
/head
身体
H4PHP中文网站/h4
/body
/html渲染:
关于编程的更多知识,请访问:编程教学!以上是CSS怎么的详细内容,文字两边有横线。请多关注其他关于 PHP知识的相关文章!