【发布时间】:2020-01-21 22:23:57
【问题描述】:
在 Chrome 中,带有 text-overflow 的项目的缩进 (text-indent) 版本的行为不再与以前相同。
在 Chrome 版本 77.0.3865.75 之前,缩进文本仍会显示省略号。 I can see that in the changes they've modified the way text-overflow works in the Chromium project.
在 Firefox、Safari 和 Edge 中,缩进的工作方式仍与以前相同(请参阅下面的 Codepens 进行测试)
我的问题:
- 关于解决此问题的好方法有什么想法吗?
- 对于我自己的教育,这是 Chromium 错误还是其他浏览器未遵循规范?
示例:
鉴于此 HTML:
<div>
<h1>A long title over a character limit</h1>
<h1 class="indent">A long title over a character limit</h1>
</div>
还有 CSS:
div {
width: 25em;
background: #ccc;
padding: 1em;
}
h1 {
max-width: 100%;
width: 100%;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
h1.indent {
text-indent: 2em;
}
我们看到在基于 Chromium 的浏览器中,h1.indent 版本的标题没有省略号。
在 Firefox 和其他浏览器中,text-overflow 再次按预期工作。在较新的基于 Chromium 的浏览器中,它没有。
截屏:
以下是 codepen 中 HTML/CSS 的副本: https://codepen.io/camsjams/pen/yLBGBvP
这是一个在 HTML 表格中显示的代码笔: https://codepen.io/camsjams/pen/dybwbWr
【问题讨论】:
标签: html css google-chrome chromium