tech @ Beacon Deacon

Firefox Exception?

Jamie Johnson
Author of Velocity: The Basics: Scripting with a $ here and a # to do, Web Developer and former Computing Support Analyst and Licensed Professional Counselor

March 4, 2015

Firefox has become the new IE (Internet Explorer). It used to be that I had to code exceptions for IE, but in one of my most recent projects, I have had to code exceptions for Firefox. The newer versions of Firefox reveal an obese browser that has slowed down (and even locked up) more often than its earlier versions. While the Add-ons and Extensions are great, there is a cost if you are going to use Firefox -- at least for now. Old IE had conditional IE statements and I have written elsewhere about detecting all versions of IE. However, what is one supposed to do with Firefox? Well, believe it or not, there is exception code available in CSS. It's not the "starmasking" that I have described elsewhere. It is a bit more. Think media queries as the idea is similar in that Firefox-only rules have their own scope of code. Here is the way you write Firefox-only code in CSS:

@-moz-document url-prefix() { 
       selector { property: value; }

That's it!

So, if you need to single out Firefox for styles, you can.