在左侧用CSS省略号截断字符串

时间:2018-10-18 20:26:57

标签: html css

我知道这听起来很奇怪,但是我需要在字符串的左侧完成这个操作

https://css-tricks.com/snippets/css/truncate-string-with-ellipsis/

例如:代替“ Hello ...”,我需要使用“ ... olleH”

有人知道有没有办法做到这一点?预先感谢。

2 个答案:

答案 0 :(得分:1)

.truncate_class {
  overflow: hidden;
  width: 60px;
  direction: rtl;
  margin-left: 15px;
  white-space: nowrap;
}

.truncate_class:after {
  position: absolute;
  left: 0px;
  content: "...";
}
<p class="truncate_class">12154543554534351432123</p>

答案 1 :(得分:0)

使用{ "_schemaVersion": "1.0.0", "SomeFunc": { "inputs": [ {"name":"Operation", "kind":"required", "type":["char", "choices={'Option1','Option2'}"]}, {"mutuallyExclusiveGroup": [ [ {... Set 1 of operations ...} ], [ {... Set 2 of operations ...} ] } ] } } 仅交换默认的从左到右布局。
要向后翻转每个字母,您需要unicode-bidi属性。

dir: rlt
.toTruncate {
  direction: rtl;
  unicode-bidi: bidi-override;
  max-width: 50px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

相关问题