我正在寻找一种方法来实现与overflow-wrap: break-word;
相同的绝对定位文本。
这是一个问题的演示:
.container {
position: relative;
width: 110px;
height: 110px;
border: 1px dashed red
}
.text {
position: absolute;
bottom: 0;
/* How to archive the same effect as following */
/* overflow-wrap: break-word; */
}
<div class="container">
<span class="text">loremipsumdoloremelit</span>
</div>
谢谢你的任何建议
word-break: break-word
会做你想做的吗?好像。
.container {
position: relative;
width: 110px;
height: 110px;
border: 1px dashed red
}
.text {
position: absolute;
bottom: 0;
word-break: break-word;
}
<div class="container">
<span class="text">loremipsumdoloremelit</span>
</div>
添加此属性
word-break:break-all;
.container {
position: relative;
width: 110px;
height: 110px;
border: 1px dashed red
}
.text {
position: absolute;
bottom: 0;
/* How to archive the same effect as following */
/*overflow-wrap: break-word; */
word-break:break-all;
}
<div class="container">
<span class="text">loremipsumdoloremelit</span>
</div>