是否可以使用 CSS 圆角并仍然通过验证?
IIRC 情况是 IE 根本不支持圆角,但其他一些浏览器需要特定于浏览器的扩展......无论是 FF 还是 web-kit,我不记得了。
我很高兴在某些情况下使用它并让 IE 回落到方角,但是使用浏览器扩展 CSS 会破坏验证...我非常喜欢让我的网站在 IE6 上进行验证和工作。
IIRC the situation is that IE simply doesn't support rounded corners, but some other browsers need browser-specific extensions... either FF or web-kit, I don't recall.
I'm happy to use it in some cases and let IE fall-back to square corners, but does using browser-extension CSS break validation... I quite like having my site validate AND work on IE6.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
border-radius
将根据 CSS3 进行验证,并可在 IE9 和 Opera 9.5+ 中工作。要在 Gecko (Firefox) 和 WebKit (Safari、Chrome) 中支持圆角,您需要供应商扩展
-moz-border-radius
和-webkit-border-radius
现在。最终(当 CSS3 背景和边框 达到推荐阶段时),这些浏览器将还支持简单的 border-radius 属性,但目前还不支持,因为对于特定椭圆和多个角的确切语法仍有一些问题需要解决。-vendor-x
扩展属性永远不会验证,这很遗憾,但它们由 CSS 本身定义为无害的,因此您可以安全地忽略这些错误。border-radius
will validate against CSS3 and will work in IE9 and Opera 9.5+.To support rounded corners in Gecko (Firefox) and WebKit (Safari, Chrome) you would need the vendor extensions
-moz-border-radius
and-webkit-border-radius
for now. Eventually (sometime around when CSS3 Background and Borders reaches Recommendation stage), those browsers will also support the simpleborder-radius
property, but for now they don't as there are still some issues to be hammered out over the exact syntax for specific elliptical and multiple corners.The
-vendor-x
extension properties will never validate, which is a shame, but they are defined by CSS itself to be harmless so you can safely ignore those errors.我认为大多数浏览器不再需要特定的扩展:只需使用 border-radius,并确保将 CSS 验证为 CSS3(而不是 CSS 2.1,W3C 验证器的默认值)。
I think that most browsers no longer need specific extensions: simply use
border-radius
, and make sure you validate your CSS as CSS3 (rather than CSS 2.1, which the default for the W3C validator).无效的 HTML/CSS 并不是 IE6 等浏览器中页面崩溃的原因,而是因为它们不遵循标准。
IMO,如果您使用 CSS 属性进行渐进增强,则验证毫无意义。如果页面的其余部分有效,则添加边框半径(包括特定于供应商的属性)在其他浏览器中不会中断,它们只是忽略该属性。
Invalid HTML/CSS is not why pages break in browsers like IE6, it's because they don't follow the standard.
IMO, validation is meaningless if you're using a CSS property for progressive enhancement. If the rest of the page is valid then adding border radius (including the vendor-specific properties) doesn't break in other browsers, they just ignore the property.