PDA

View Full Version : How to tell if particular CSS feature supported?


wilson@cpuworks.com
01-02-04, 09:05 AM
How do I tell if the user's browser properly supports a particular CSS feature?I know I can say "if (document.all)", that sort of thing. But I'm finding that one element ("clip") doesn't work properly on some browsers. My code says something like " document.getElementById('area').style.clip='rect(1 00 200 300 0)';"
This works fine on some browsers, but is ignored on others. (The example shown should show only the part of layer "area" from 0,100 to 200,300 .) No error is thrown, just no clipping is done. Is there a way to test if the feature is supported, or do I have to hand-test all combinations of browser, version, and OS (Windows or Unix are targets) and then fudge-code it? I'm fine with requiring a new-enough browser to support the document.getElementById method, but this kind of tweaking is irritating and hard to support.

dwikristianto
07-05-07, 09:37 PM
hi wilson,

website has to be cross browser. that's the main idea.
but, each developer of the render engine developed differently, that's why your site doesnt show exactly the same.

for now, i only test my work with firefox, ie6, opera and safari. i think that's enough to make sure my site will look and operate exactly the same in all browser.

cheers,

job0107
07-06-07, 01:26 AM
If clip isn't supported by all browsers then you can do your own clip by using a div element with it's overflow property set to none.