引导模式中的文本溢出省略号

问题描述 投票:0回答:2

我想要获得的是Bootstrap模态体中非常长的文本内容,它放在一条线上,如果长于模态宽度则以省略号结束。

<div class="modal-body">
    <span>Some very very very long text in the modal.</span>
</div>
css twitter-bootstrap twitter-bootstrap-3 modal-dialog
2个回答
0
投票

尝试:

CSS

.ellipsis {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

HTML

<div class="modal-body">
  <div class="ellipsis">Some very very very long text in the modal.Some very very very long text in the modal.Some very very very long text in the modal.Some very very very long text in the modal.</div>
</div>

但是:ぁzxswい


0
投票

对于bootstrap 4,现在有http://jsfiddle.net/lotusgodkk/GCu2D/2084/类也会这样做。

text-truncate
© www.soinside.com 2019 - 2024. All rights reserved.