today I’m trying to optimize my website for a better rendering in firefox!
my problems are the text-shadow and font-weight properties … I would like to set custom values only for firefox (my website is mac only compatible so I don’t need IE compatibility) but I don’t wont to use separate style sheet for only these two properties!!!
There is any way to do that? Or I must use a php script to filter the user agent and load customized style sheets for firefox?
Thanks in advance!
You seem like you would want to support ONLY browsers which support
text-shadow, so why only target Firefox? Your approach should be to only changefont-weightfor those browsers which supporttext-shadow. But this is easier said than done.Browser sniffers are not going to work unless they can differentiate between Firefox 3.5 and earlier versions. The one linked to by KahWee would not achieve this, but I would NOT recommend browser sniffing anyway — it is not best practice.
I would instead recommend setting
font-weightto whatever is meant for use withtext-shadow, and then include an IE conditional to reset the majority of visitors’ browsers back to the original, non-shadowedfont-weight.Example:
With this you will achieve
text-shadowwith properfont-weightin these browsers:And if you want drop shadow in IE you can use
filterexpressions withDropShadow(), but I personally do not recommend using proprietary CSS extensions.Your only real “loss”, then, would be having an improper
font-weightfor older, non-IE browsers like Firefox 3.0 and lower, and Opera 9.2x and lower.So is it really worth JavaScript or PHP browser sniffing to change the
font-weightfor a very limited subset of older browsers?If the answer is still yes, there are PHP browser sniffers like this one.