html - 文本溢出 : ellipsis property not working for IE11 browser

标签 html css

在 Chrome 浏览器的情况下,以下 css 有效并显示省略号(以红色突出显示),结果如下所示:

Chrome :

position: relative;
display: -webkit-box;
max-height: 136px;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;

结果:

enter image description here

但在 IE 11 的情况下,它不显示省略号:

enter image description here

enter image description here

谁能帮我解决这个问题?

最佳答案

经过测试,它似乎工作正常:https://jsbin.com/zaxasamoxa/1/edit

h1 {
  width: 100px;
  position: relative;
  display: block;
  display: -webkit-box;
  max-height: 136px;
  -webkit-line-clamp: 4px;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
<h1>absdfmksdlfmdlskflsdkfmlsdkmflskdmf</h1>

检查您的 CSS 是否有其他规则可能会把事情搞砸。

请注意 display: -webkit-box; 将打破 chrome 中的省略号。

https://caniuse.com/#feat=text-overflow 也证实了支持

enter image description here

关于html - 文本溢出 : ellipsis property not working for IE11 browser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56148684/

相关文章:

javascript - .eq(count) 和 [count] 之间的 jQuery 区别

html - 定位元素、DIV 和 IMG

javascript - 转换属性 jquery

html - Div 不按内容扩展

JavaScript .click 在 DIV 上不起作用,为什么?

Javascript/jQuery 自动设置和更新时间

html - 将 div 框添加到列表 li

html - 修复页脚表格/div 问题

html - 使 div 不可复制

wordpress - 努力在WordPress下覆盖@media最小宽度CSS规则