internet-explorer - 文本溢出 : ellipsis in IE

标签 internet-explorer css

当我在 IE 中使用 text-overflow: ellipsis; 时,我遇到了两个长单词的问题:

在 Chrome 中它看起来像:

firstlongword1...

secondlongword2...

在 IE 中:

firstlongword1...

secondlongword2 //word cropped, but dots not present

HTML 和 CSS:

.orange {
    color: #f58026;
    text-overflow: ellipsis;
    display: block;
    overflow: hidden;
}
<span class="orange" title="12 12">first_verylongworddddddddddddddddddddddddddddddddddddddddddd second_verylonglonglonglonglonglonglonglonglonglong</span>

如果有人遇到问题,请帮忙。 或者请告诉我是否存在其他修复方法。

最佳答案

检查 CSS 规范,Chrome(和 Firefox)似乎正确显示了省略号,IE 似乎落后于曲线。转到 http://www.w3.org/TR/css3-ui/#text-overflow0并向下滚动到 Example 9 以查看有关如何呈现 text-overflow:ellipsis; 的演示。

因此,在 IE 中获得类似结果的唯一方法似乎是将单词包装在它们自己的元素中:

.orange {
    color: #f58026;
    display: block;
    text-overflow: ellipsis;
}
.orange span {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
<span class="orange" title="12 12">
    <span>first_verylongworddddddddddddddddddddddddddddddddddddddddddd</span> 
    <span>second_verylonglonglonglonglonglonglonglonglonglong</span>
</span>

JS fiddle : http://jsfiddle.net/fL6za37f/2/

关于internet-explorer - 文本溢出 : ellipsis in IE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26115421/

相关文章:

javascript - $.getJSON 在 IE10 中不工作,

internet-explorer - CSS3Pie 不适用,而是边框消失

internet-explorer - HTTP_USER_AGENT 和 navigator.userAgent 不一样,知道吗?

html - Bootstrap : how to align and center buttons at the bottom of equal-height columns

javascript - Html2pf/html2canvas/jsPDF 使用 Bootstrap 模式不显示边框

css - Material ui 中的波纹影响用不同的颜色填充按钮

internet-explorer - IE11 - 如果 block 数据大于 4kiB,则不会触发 XMLHttpRequest 级别 2 onprogress 事件

Jquery 动画没有同时执行 - 已经尝试了一切

html - 当容器中没有足够的空间时,我可以使用 Flexbox 将两个 html 输入分成各自的行吗?

css - IE10 不支持填充的 css 转换?