尝试使用sass / css在第二行之后添加省略号?

时间:2017-01-19 14:06:30

标签: html css sass

在jsfiddle链接中你可以找到我尝试过的内容,但是当文本超过两行时,我不再看到省略号了。有人可以帮助我吗?我是CSS的新手,以及使用CSS / SASS解决这个问题的方法。

.exciting-text {
  display: block;
  text-overflow: ellipsis;
  word-wrap: break-word;
  overflow: hidden;
  max-height: 2em;
  line-height: 1em;
}
.exciting-text::after {
  content: "...";
  color: red;
}
<p class="exciting-text">Contributing to MDN is easy and fun.Just hit the edit button to add new live samples, or improve existing samplesdfsfssfddcdxcxdsdzxfsfdsadasdaddsadsadsadsadsadasdasfds.</p>

1 个答案:

答案 0 :(得分:0)

在当前示例中,您的问题是a。摆脱它,你的伪省略号将始终可见。