Isn't “text-overflow: ellipsis” valid CSS?

帅比萌擦擦* 提交于 2019-12-10 12:57:23

问题


This code triggers an error when run through the W3C CSS Validator:

p{
    text-overflow: ellipsis;
}

I get:

Line     Code context      Error/Warning
2        p                 Parse Error [empty string]

Is it just a bug in the validator or am I missing something really obvious?


回答1:


This is a bug in the CSS validator, it has been already reported. text-overflow:ellipsis is a valid rule, however the W3C CSS validator is unfortunately prone to errors (see bug list).

However, note that the current working draft lists some text-overflow values as 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.

While this doesn't affect the ellipsis value, it could be the source of the bug in the validator:

Parse Error [empty string]

References

  • W3C: CSS Basic User Interface Module Level 3 (CSS3 UI): (WD-20120117)
    • Features at risk
    • 8.2. Overflow Ellipsis: the ‘text-overflow’ property



回答2:


It's valid based on MDN's reference, which also links to the spec: http://dev.w3.org/csswg/css3-ui/#text-overflow

Out of curiosity, I ran one of my own sites through the validator. I noted that it listed a few things that I would not consider errors, such as properly prefixed vendor extensions and data URIs.



来源:https://stackoverflow.com/questions/11757446/isnt-text-overflow-ellipsis-valid-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!