问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
<div class="opinionDiv">
<span class="textStyle">测试用,再次通过测试用,再次通过测试用测试用,再次通过测试用,再次通过测试用测试用,再次通过测试用,再次通过测试用测试用,再次通过测试用,再次通过测试用测试用,再次通过测试用,再次通过测试用测试用,再次通过测试用,再次通过测试用测试用,再次通过测试用,再次通过测试用测试用,再次通过测试用,再次通过测试用测试用,再次通过测试用,再次通过测试用测试用,再次通过测试用,再次通过测试用,再次通过测试用,再次通过测试用,再次通过测试用,再次通过测试用,再次通过测试用,再次通过测试用,再次通过测试用,再次通过测试用,再次通过测试用,再次通过测试用,再次通过测试用,再次通过</span>
</div>
.opinionDiv {
height: calc(100vh - 345px);
overflow-y: auto;
font-size: 16px;
}
.textStyle {
line-height: 40px;
text-decoration:none;
border-bottom:1px dashed #3d3d3d;
display: inline-block;
text-indent:2em;
width: 100%;
}
运行结果及报错内容
span标签内只有最外层能够设置border-bottom
我的解答思路和尝试过的方法
计算宽度,再根据宽度截取字符串的长度,但是字符串中不知有中文,还有数字、字母、下划线等等,做出的效果并不好
我想要达到的结果
span标签内可以添加属性,加入行线