法一:
html:
<div id="separator" class="separator-wrap">
<span class="separator-symbol">|</span>
</div>
css:
.separator-wrap {
height: 10vh;
line-height: 10vh;
display: flex;
flex-flow: row nowrap;
align-items: center;
}
.separator-symbol {
font-size: 5vh;
font-weight: 100;
color: #c7bdbd;
}
效果:
法二:
<div style="float:left;width: 1px;height: 25px; background: #000;"></div>
本文介绍了两种实现网页中水平分隔线的方法:一种使用HTML和CSS结合的方式,定义了一个带有样式的div元素作为分隔符;另一种则通过简单的HTML标签设置背景颜色和高度来达到相同的效果。
265

被折叠的 条评论
为什么被折叠?



