Firefox specific margin?

50,552

Solution 1

Your problem probably lies elsewhere, but here's how you target Firefox only:

@-moz-document url-prefix() {
    a {
        margin: 0;
    }
}

Solution 2

You can try something like this:

@-moz-document url-prefix() { //Your css here }

That will only be read by Firefox.

Source

Solution 3

To directly answer your question:

.myElement, x:-moz-any-link, x:default {
    margin: 0px;
}

This will set all elements with the 'myElement' class to a 0px margin within firefox only.

Share:
50,552
Matt
Author by

Matt

Updated on August 31, 2020

Comments

  • Matt
    Matt over 3 years

    How can I set a specific margin for Firefox in CSS? I tried -moz-margin:0px;

    My problem is in every browser, even IE works,

    but firefox fails at my CSS now... There are certain links that move like 1px to the left when I rollover them...

  • Rohit Verma
    Rohit Verma over 6 years
    Thanks bro for sharing it!