View Full Version : Testing for specific CSS features.

03-18-2005, 11:26 AM
In order to make sure users get the best experience when using my website, i want to make use of the CSS3 opacity feature (or any other proprietary tag other browsers may use). Therefor i need to test if the browser supports these properties. I have come up with the following code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="application/x-javascript">
function test_opacity()
<div id="test" style="opacity: 0.5;">

This appears to work. For example, Opera gives me "undefined" alert.
However, i am afraid that other browsers that also don't support these features simply return the value, and ignore it for the rest.

Can someone tell me if this is a good way to test for CSS functionality?