Log in

View Full Version : Property box-shadow doesn't exist in CSS level 2.1 ERROR



nihilater
10-12-2009, 05:56 AM
I have a Jquery Plugin and it includes a CSS for curve corners but when I validate it in the Validator, it says

'Property box-shadow doesn't exist in CSS level 2.1 but exists in [css3]'

'Property -moz-box-shadow doesn't exist : 0 2px 3px #444 '

'Property box-shadow doesn't exist in CSS level 2.1 but exists in [css3] : none '

those kind of errors.

I have this CSS code


box-shadow: 0px 0px 6px #000;
-moz-box-shadow: 0px 0px 6px #000;
-webkit-box-shadow: 0px 0px 6px #000;
padding:4px 10px 4px 10px;
border-radius: 6px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;

what can i do to make it valid? I'm thinking of a doctype or something like to make it compatible with my code. thanks!

simcomedia
10-12-2009, 04:59 PM
Yeah, none of that will validate since the 'radius' statements are specific to two browser types and CSS3 isn't out yet for the border and box-shadow elements aren't supported. Bummer, eh?

Here's a link to a rounded corners method that does validate:

http://www.cssplay.co.uk/boxes/snazzy.html

nihilater
10-13-2009, 05:18 AM
Oh crap. I'll just edit that with the ones you gave. Thanks man. Hope they fix that to work on all browser in the future;.

traq
10-13-2009, 08:04 PM
well, here's something to consider: although it doesn't validate, it does work. and there are several different lines to make it work across browsers.

So, why do you want your code to validate? Just to make sure it works? It works, so don't worry. Valid markup isn't garunteed to work anyway.

Do you want your client to see that your work validates? Put all the non-validatable (is that a word?) code into a seperate file. That way, it's easier to explain why these few things don't validate (but still work and are "good") and, at the same time, show that you do know what you're doing and can write valid code.

:D

coothead
10-13-2009, 09:27 PM
Hi there nihilater,

if you validate your css here...
http://jigsaw.w3.org/css-validator/
...click "More Options" and you will find the the default setting is "CSS level 2.1".

Set to "CSS level 3" your code will validate, except for the propriety attributes, of course. ;)

coothead

nihilater
10-14-2009, 06:14 AM
Yep, cuz I need to make sure my employer sees that the whole page is validated. Hmm, but I guess I can argue that with him that it really works although it doesn't validate. I just asked cuz i thought there was a solution or something.

@coothead, thanks man, yeh it does lessen the errors. I didn't know there is such an option, thanks. :)

coothead
10-14-2009, 06:20 AM
No problem. you're welcome. ;)

traq
10-14-2009, 03:31 PM
Yep, cuz I need to make sure my employer sees that the whole page is validated. Hmm, but I guess I can argue that with him that it really works although it doesn't validate. I just asked cuz i thought there was a solution or something.

@coothead, thanks man, yeh it does lessen the errors. I didn't know there is such an option, thanks. :)

Well, part of being a good coder is knowing what is best practice. There's plenty of resources online detailing the extent of accommodations that have to be made for various browsers, if your employer wants to know more.

It doesn't just "work", it actually is the best way of doing things. (BTW, I would use the word explain rather than argue: you're not making an excuse for any shortcomings, you're explaining why what they want doesn't look exactly like they expected.)

Good luck