Web Development

Web Development Tips & Tricks, the things that you don’t want to figure out.





Archive for the ‘CSS

Browser-Specific CSS

Saturday, January 26th, 2008

If you’ve done much with CSS at all you know that the IE’s not only display differently than Firefox, but IE7 displays differently than IE6.

Instead of using Javascript or another scripting language to determine what browser is being used, there are a few simple techniques that can handle that problem for you. This works inline or through an included stylesheet.

CSS

h1 {
font-size: 20px;
#font-size: 22px;
_font-size: 10px;
}

The first applies to all browsers, Firefox, IE7 & IE 6. The second applies to IE7 & IE6. The last applies to only IE6. This means that if you define them in the order I have given you, the top only effects Firefox, while the second line only affects IE7 and the last line only affects IE6.-Kerry