Log in

View Full Version : backwards compatibility



evan
12-15-2010, 08:52 PM
I'm no wiz with getting my new code which I plan on doing over in css3 -but what if I am worried about browsers that are not compatible with it -how would I go about coding my css to revert to older code?

petercpwong
12-19-2010, 08:24 PM
I don't suggest using CSS3 since not even modern browsers fully support it. Wait a few more years before actually using it.

Here's a great resource regarding CSS features supported in commonly used browsers:
http://www.webdevout.net/browser-support-css

traq
12-20-2010, 04:21 AM
You can use css3 wherever it is not critical - for extra effects, etc. - as long as it won't break your layout or make something unusable.

With some properties, you can use "fallbacks" - for example, css3 allows gradients and semi-transparent backgrounds:
div{ background: url(semi-transparent.png); }
div{ background: hsla(0,100%,50%,0.2); }the css2 browser ignore the second rule because it doesn't understand it, and shows the background image (which is supposedly a similar color and opacity). The css3 browser understands hsla, so it "overrules" the previous background rule.

You can also look into using javascript to provide css3 effects in browsers that don't support them. That all depends on how important a particular effect is to you.

evan
01-16-2011, 01:17 PM
Thank you, I need to know hoe to write a conditional statement to derect what browser or device someone has so the right CSS will be applied -as with a mobile device.

traq
01-16-2011, 07:39 PM
you may find this (http://css-tricks.com/css-media-queries/) useful.