views:

19

answers:

2

I really want to make use of multiple background support (Webkit, Firefox 3.6+), but I would like to provide an alternative solution for browsers that don't support it. (IE, Firefox 3.5-).

Is there any way to detect support for this CSS feature? Or will I have to resort to browser sniffing?

EDIT: Javascript solutions are welcome

+2  A: 

Use http://www.modernizr.com/. This is a piece of javascript that will set up classes depending on what features the browser have. You can then use these classes in CSS.

liori
Is in question any javascript mentioned?
Miro
@Miro - it wasn't mentioned, but it seems to be required. Modernizr does seem to answer the question.
Spudley
@Miro: this is a solution which has not been ruled out by specification (yet), and which will work when correctly applied. Do you have any objections?
liori
some people are surfing without scripts :)
Miro
@Miro: modernizr has a fallback feature, where it removes .no-js class from <html> when it exist. Then you can resolve having/not having JS in CSS.
liori
Exactly what I was looking for! thank you.
jessegavin
+2  A: 

No there is no way in pure css to detect if multiple backgrounds are supported. But you can specify default background and then specify multiple backgrounds which resolves error with processing value and keeps old if it isn't supported.

Miro
I will try this too. Thanks.
jessegavin