Conditional CSS for Firefox/Gecko browsers

Last year I posted how to add conditional comments for webkit-based browsers. This time I found a really cool hack on how to do the very same thing for Firefox/Gecko-based browsers (from Chris Coyier). The solution is again very simple and it’s based on a media query that only Firefox/Gecko-based browsers will parse.

See the Pen Conditional CSS for Firefox/Gecko browsers by John Tsevdos (@tsevdos) on CodePen

2 thoughts on “Conditional CSS for Firefox/Gecko browsers”

  1. May be better to collect all browser specific hacks in a external file and import that tidy code.
    @-moz-document url-prefix() {
    @import url(“ff_hack.css”);

    Method #2:Specific class name can be added by JavaScript condition if browser is “firefox”

    if (‘MozBinding’ in {
    document.documentElement.className= ‘firefox’;

    // By Melbourne Web Designer & SEO Group

  2. Good point, I just wanted to keep it simple and to the point. Of course you can create a firefox only style and import it with that technique.

Leave a Reply