如何在绝对定位的文本上实现与分词相同的效果?
How to archieve the same effect as word-break on absolute positioned text?
我正在寻找一种方法来实现与 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>
我正在寻找一种方法来实现与 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>