简体   繁体   English

Google字体API生成CSS 2.1验证错误

[英]Google fonts API generates CSS 2.1 validation errors

Call me a rube, but I want my work to validate. 叫我卢布,但我希望我的工作能得到验证。 Pages using the Google Font API validate as CSS3, but not as CSS2.1. 使用Google Font API的网页验证为CSS3,而不验证为CSS2.1。 Here is the href, straight out of the Google instructions: 这是href,直接来自Google的说明:

<link href="http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz" rel="stylesheet" type="text/css" id="googlefont" />

CSS 2.1 and XHTML 1.0 Strict are unreasonably restrictive, so I'm not against scripting workarounds when there is no workable solution (ie for embedding Flash video, that is, there's no other cross-browser, easily implementable solution that I know of). CSS 2.1和XHTML 1.0 Strict的限制不合理,因此,当没有可行的解决方案时(例如,嵌入Flash视频,也就是说,没有其他跨浏览器,易于实现的解决方案),我不反对脚本解决方法。 So, is there a workable solution, and if not, can anyone suggest a script workaround? 那么,有没有一个可行的解决方案,如果没有,有人可以提出脚本解决方法吗? Or should I just validate as CSS3 and call it good? 还是应该将其验证为CSS3并称其良好?

Thanks, 谢谢,

motorhobo motorhobo

Isn't it obvious why that doesn't validate as CSS2.1? 不是很明显为什么不能作为CSS2.1进行验证吗?

Google Font API is using @font-face , which isn't CSS 2.1. Google Font API使用@font-face ,而不是 CSS 2.1。 @font-face is currently included in the CSS Level 3 Working Draft , and also in the now deprecated CSS 2 documents. @font-face目前包含在CSS 3级工作草案在现在反对的CSS 2个文件。 It will validate if you check it against both of these specifications, but not CSS 2.1. 它将验证是否根据这两个规范(而不是CSS 2.1)对它进行检查。

Here is an interesting article explaining why validation isn't everything. 这是一篇有趣的文章,解释了为什么验证不是全部。 It's nice to do to be sure there no mistakes like orphaned tags. 确保没有孤立标记之类的错误,这很高兴。 In reality there won't be any problems if it is valid CSS3 and doesn't validate in CSS2.1. 实际上,如果它是有效的CSS3并且未在CSS2.1中进行验证,就不会有任何问题。

http://www.codinghorror.com/blog/2009/03/html-validation-does-it-matter.html http://www.codinghorror.com/blog/2009/03/html-validation-does-it-matter.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM