开发者

W3 VALID cross browser css gradient,

开发者 https://www.devze.com 2023-04-10 15:40 出处:网络
I am trying to find html conditional statement so that I can reference the required additional .css file. Opera, Ie8, Safari.

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 fai开发者_运维技巧l!

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.


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.


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号