tags:

views:

268

answers:

3

Is it possible in javascript to know if a css property is supported by the client browser? I'm talking about the rotation properties of css3, i want to execute some functions only if the browser supports them.

A: 

To start with the fact that I do not know the answer but would good old browser capability detection work like:

if (document.images)

But in your case you would use the css3 property you want to use?

Janco
+1  A: 

Maybe you are looking for something like this? http://www.filamentgroup.com/lab/delivering%5Fthe%5Fright%5Fexperience%5Fto%5Fthe%5Fright%5Fdevice/

The other thing to think about is what you want for default if JS is turned off.

Kyle Kochis
that article is interesting but it doesn't solve my problem. I want to know only if a css property is supported.
mck89
yeah. I was afraid of that. In that case I'm pretty sure you can't do that with CSS3 rotation at this point. You could always try the non-standards way of achieving cross-platform rotation found at http://www.ditii.com/2009/07/30/html-text-rotation-with-css/ but I don't necessarily recommend it.
Kyle Kochis
+3  A: 

There's a very simple inference strategy that often allows to detect CSS support quite reliably. I blogged about it recently. Take a look at a demo page with some of the CSS tests.

kangax
it seems to work thanks
mck89