我嘗試下面的代碼:如何獲得CSS屬性「text-overflow:ellipses」的反向行爲?
#my-div{
background-color: lightblue;
display: inline-block;
width: 200px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
<html>
<body>
<div id="my-div">The quick brown fox jumps over the lazy dog</div>
</body>
</html>
你可能注意到了,在3點替換句子中,因爲溢出的DIV的最後一部分。我怎樣才能扭轉這種行爲?是否有可能用3個點代替句子的第一部分(即隱藏起始部分的溢出而不是結束部分)?
你可能會在這裏找到一些建議:1)在左側文本溢出省略號(HTTPS:/ /stackoverflow.com/questions/9793473/text-overflow-ellipsis-on-left-side),2)[從左邊截去的溢出](https: //stackoverflow.com/questions/12761418/i-need-an-overflow-to-truncate-from-the-left-with-ellipses),和3)[反向省略號](https://hugogiraudel.com/2014/12/16/css-riddle-reverse-ellipsis /) – showdev
看看[this](http://hackingui.com/front-end/a-pure-css-solution-for-multiline-text-truncation /) –