HTML5 样板、HTML5 重置 CSS 验证
我正在为我的 Web 项目选择 HTML5 模板。过去几个月我一直在使用 HTML5 Initiliazr,它使用 Boilerplate,但决定重新评估这两个模板,因为我不喜欢 HTML5 Boilerplate 的 CSS 对 W3 CSS 验证器 (CSS3) 无效的问题。
现在我的问题是,考虑到两个 CSS 重置也考虑了供应商的怪癖,这些重置是否完全有效,或者不可能假设这样的事情?
我确实注意到 HTML5 Reset 实际上比 Boilerplate 少了一些问题,但将来可能会改变。然而,我确实阅读了 Boilerplate 关于为什么引入每种样式以及它解决什么问题的解释,所以它有点道理。
那么你觉得怎么样?
I'm in the process of selecting an HTML5 template for my web projects. I've been using HTML5 Initiliazr which uses Boilerplate for the last few months but decide to reevaluate the two templates, since I don't like the issues with HTML5 Boilerplate's CSS not being valid against W3 CSS validator (CSS3).
Now my question is, given the fact that both CSS resets also take into account vendor quirknesses, will those resets ever be completely valid or is it impossible to assume such a thing?
I did noticed that HTML5 Reset actually has a few issues less than Boilerplate but that might change in the future. However, I did read Boilerplate's explanation on why each and every style was introduced and what problems it solves, so it kinda makes sense.
So what do you think?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Boilerplate 的 css 使用了一些 hack,如 * (*font-size:small;) 和一些浏览器特定的 css 规则 - 如果您真的关心验证,只需将 hacky 规则移出主 style.css 并为需要的浏览器加载它们只有他们。
你可以是黑客和跨浏览器的,也可以是有效的和降级的。不要忘记样板还指出:
但是如果你问我 - 尝试通过 css 验证并且仍然跨浏览器兼容是浪费时间 - 如果你的客户需要它并且有额外的钱来支付 css 有效徽章(这可能不会产生任何额外的费用)收入)而不是去争取,如果你个人沉迷于必须通过它,那就去争取 - 否则这是无稽之谈,浪费你的时间。如果您正确编写了所有有效的 css3 规则并使用了一些供应商特定的规则,那么它不会真正杀死任何人。
总体而言,样板是一个可靠的模板,完全可以用于日常项目,并且您所暴露的问题更多的是完美主义者对事物的看法。这就是我的 2 美分。
Boilerplate's css uses few hacks like * (*font-size:small;) and some browser specific css rules - if you are really concerned about validation just move the hacky rules out of the main style.css and load them for the browser that needs them only.
You can be either hacky and crossbrowser or valid and degraded. And don't forget that boilerplate also states:
But if you ask me - its waste of time trying to pass the css validation and still be crossbrowser compatible - if your client demands it and has extra money to pay for the css valid badge (which probably won't generate them any extra income) than go for it, if you personaly are obsessed by having to pass it go for it - otherwise it's nonsense and waste of your time. If you wrote all of the valid css3 rules correctly and used a few vendor specific rules it won't really kill anyone.
Overall Boilerplate is a solid template and perfectly ok to use for every day projects and the problems you are exposing are more of a perfectionist's view on the thing. This would be my 2 cents on this.