How to write separate style sheet for Mozilla Firefox
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is generally considered extremely bad practice these days to write browser-specific stylesheets, so it would be interesting to hear why you feel you need to do this.
The one exception to this rule is if you need to support older versions of IE, which have a few incompatibilities with other browsers that can’t easily be resolved in other ways. But even for IE the cases where you’ll need to do this are few and far between. For Firefox they’re virtually nil.
If you do need to distinguish between browsers due to differing features, a far better solution is to use feature detection rather than browser detection to resolve the differences.
One very good solution to this is to use Modernizr. This is a Javascript library which (among other things) adds a bunch of classes to the body tag of your HTML page. The classes it adds will be different according to the features that are supported by your browser. This allows you to write stylesheets and JS code that reference these classes, so you can have different behaviour according to the features in your browser.
If you still think that browser-detection is a good idea, here is some reading material for you: http://css-tricks.com/browser-detection-is-bad/
Hope that helps.