此代码在运行 W3C CSS Validator 时触发错误:
p{
text-overflow: ellipsis;
}
我得到:
Line Code context Error/Warning 2 p Parse Error [empty string]
这只是验证器中的错误还是我遗漏了一些非常明显的东西?
最佳答案
这是一个 bug in the CSS validator , 已经报道过了。 text-overflow:ellipsis
是一个有效的规则,但是不幸的是 W3C CSS 验证器很容易出错(参见 bug list)。
但是,请注意当前的工作草案列出了一些 text-overflow
值为 feature at risk :
The Working Group has identified the following features as at risk of being removed from CSS Basic User Interface Module Level 3 when exiting CR. Implementors are urged to implement these features, if they wish to see these features remain in this specification. All other features are either defined in a normative reference (e.g. CSS 2.1 [CSS21] or Selectors [SELECT]) or are believed to have two or more implementations, and thus will not be dropped without returning to last call.
- [...]
text-overflow
property value:<string>
text-overflow
property 2-value syntax and definition.
虽然这不会影响 ellipsis
值,它可能是验证器中错误的来源:
Parse Error [empty string]
引用资料
- W3C:CSS 基本用户界面模块级别 3 (CSS3 UI):(WD-20120117)
关于css - "text-overflow: ellipsis"不是有效的 CSS 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11757446/