W3 有效的跨浏览器 CSS 渐变,

发布于 2024-12-07 11:33:42 字数 327 浏览 4 评论 0原文

我正在尝试查找 html 条件语句,以便我可以引用所需的附加 .css 文件。 Opera、Ie8、Safari。

我正在使用:

background: -moz-linear-gradient(#ADD58A, #FFFFFF);

对于 Firefox,这很棒。但是拥有其他浏览器 CSS 属性会导致 W3 CSS 验证失败!

我相信使用 html 条件语句可以使用有效的代码来完成此操作。

在你回复之前,是的,我看过饼图,在使用饼图时我没有 3 个绿色的验证勾号,因此想要使用 html 条件而不是让浏览器“删除”样式。

I am trying to find html conditional statement so that I can reference the required additional .css file. Opera, Ie8, Safari.

I am using:

background: -moz-linear-gradient(#ADD58A, #FFFFFF);

for Firefox which is great. But having other browser css properties causes W3 css validation to fail!

I believe with html conditional statements this can be done with valid code.

Before you reply, yes I have looked at pie, i do not have the 3 green ticks of validation when using pie, hence wanting to use html conditional rather than having the browser 'drop' styles.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柏林苍穹下 2024-12-14 11:33:42

Jigsaw CSS3 验证器应该有一个选项来触发警告,而不是供应商扩展上的错误。假设您没有使用任何其他非标准样式,您的 CSS 应该以绿色通过,尽管有一些警告,但仅此而已。


至于为什么 Daniel A. White 说不用担心验证,“W3C 有效的跨浏览器 CSS3”是一个矛盾的说法。在 2011 年,大多数 CSS3 功能还无法实现这样的目标。

是的,验证您的代码以获得最大的跨浏览器互操作性。但在现实世界中,这目前仅适用于 CSS2 内容。当涉及到规范本身尚未最终确定的 CSS3 功能时,更不用说浏览器的实现(无论它们如何解释不完整的规范),有效性还没有任何意义。如果您忽略大多数现代浏览器的较新(我不会说较旧)版本,像 border-radius 这样的东西可能会起作用,因为每个主要浏览器的最新版本现在都支持官方属性名称,但没有人世界上已经实现了任何 CSS 渐变的无扩展版本。

你可以告诉他们只在验证器中触发警告,或者如果你太肛门以至于你甚至不想要警告,也许等到明年。希望事情足够稳定,主要浏览器将放弃 CSS3 渐变的前缀。

The Jigsaw CSS3 validator should have an option for triggering warnings instead of errors on vendor extensions. Assuming you haven't used any other non-standard styles, your CSS should pass with a green, albeit with a few warnings, but nothing more.


As to why Daniel A. White says not to worry about validation, well, "W3C valid cross-browser CSS3" is an oxymoron. In 2011 you simply can't achieve such a thing with most CSS3 features yet.

Yes, validate your code for maximal cross-browser interoperability. But in the real world, that's only applicable to CSS2 stuff right now. When it comes to CSS3 features where the spec itself isn't yet finalized, let alone browsers' implementations (however they interpret the incomplete spec), validity doesn't make sense yet. Things like border-radius may work if you ignore less recent (I wouldn't say older) versions of most modern browsers, since the latest versions of every major browser now support the official property name, but nobody in the world has implemented the extensionless versions of any CSS gradients yet.

You can tell them to trigger only warnings in the validator, or if you're so anal that you don't even want warnings, perhaps wait until next year. Hopefully things will be stable enough and major browsers will have dropped their prefixes for CSS3 gradients.

想挽留 2024-12-14 11:33:42

-moz 是 Firefox 供应商特定的前缀。我不会担心 CSS 验证。

也用这些定义渐变。

  • linear-gradient - 最终标准
  • -o-linear-gradient - opera
  • -webkit-linear-gradient - safari/chrome
  • - ms-线性梯度 - 即

the -moz is a vendor specific prefix for Firefox. I wouldnt worry about the css validation.

Define the gradient with these too.

  • linear-gradient - the eventual standard
  • -o-linear-gradient - opera
  • -webkit-linear-gradient - safari/chrome
  • -ms-linear-gradient - ie
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文