W3 VALID cross browser css gradient,

淺唱寂寞╮ 提交于 2020-01-15 12:38:06

问题


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.


回答1:


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.




回答2:


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


来源:https://stackoverflow.com/questions/7624115/w3-valid-cross-browser-css-gradient

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