CSS Browser Hack, different browsers, different styles

CSS          Trackback

I am totally against any CSS hacks, but sometimes if you need quick result, and you need everything to work and look exactly the same in both Firefox and IE you just have to use them. Here is simple CSS hack that you can use to apply different styles depending on browser your visitor is using.

div.test {
	background:blue;	/* Firefox, Opera */
	#background:green;	/* IE7 */
	_background:red;	/* IE6 */

First background style is compatible with all browsers (and Firefox and Opera will use this one, and stop there)
Second one (#background) will be ignored by Firefox, and you will see it in IE7, but IE7 will ignore
Third one (_background) and you will see this one just in IE6…

See this demo:
What color is a background on your screen?

No Comments

Make A Comment

No comments yet.

Comments RSS Feed    TrackBack URL

Leave a comment