html - 文本溢出问题 : ellipses in a specific height paragraph

标签 html css

例如我有一个特定高度的段落。我希望所有超过那个高度的东西都变成省略号(...),而不是像图片中那样将句子切成两半: enter image description here

我试过使用 text-overflow: ellipses 但没用。 请帮我解决这个问题。谢谢!

最佳答案

试试这段代码

div{display:block;width:300px;text-overflow:ellipsis;;overflow-y:scroll;max-height:200px;

  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
}
<div>this is text this is text this is textthis is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text</div>

关于html - 文本溢出问题 : ellipses in a specific height paragraph,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42313424/

相关文章:

html - CSS - 变换 :scale images overlapping and not scaling correctly

php - 最佳服务器端语法高亮解决方案(在 PHP 中)

html - 使用 css 个性化谷歌应用程序脚本 ui

html - 移动版 col-xs-6 中连续两个框不起作用

html - 如何在 CSS 中的一个选择器上使用背景图像和渐变背景颜色?

css - 为什么 img 没有到达其包含的 div 的底部?

html - 使用 CSS 使 Flex 容器的第二项具有粘性

html - 模态弹出窗口关闭,再次打开时不刷新

html - 按下按钮后切换 CSS 中的关键帧?

javascript - 无论屏幕大小如何,都适合屏幕内的内容 - Bootstrap