<div style="color: red">test</div> <div style="color: blue; margin-top: 3px;">test</div> 

Firefox instead of 3px substitutes its 5px. How to fix?

  • it’s probably an error somewhere, show more code - such a short code works correctly - Andrei Sovetkin
  • I noticed this, only 1px more, in chrome everything is exactly ... in principle this question is also interesting. - thunder
  • 3
    The second time I remove the bad-browser label. - insolor

4 answers 4


 line-height: 1px; 

In this regard, Mozilla and IE as if agreed.

    Are you sure about this?

    Maybe !important help?

     <div style="color: blue; margin-top: 3px!important;">test</div> 
    • @ vesel4ak, did not help. - ModaL

    What do you want to get? Not quite clear. In firefox, the distance between divs is exactly 3px

    • Maybe in the latest version and exactly. But in the penultimate there are lags. That all increases, while you will not set height, and if and you set, the text falls on 2 pixels below. Or you can add a margin of 3 pixels, and your firefox +2 pixels still thrusts. - ModaL
    • Gash on jsfiddle, please. Or you just need something else. It’s hard to understand what the problem is. Margin-top behaves as it should and in early versions - psycho_Octopus

    For the text, set the line-height - the inline spacing will be the same everywhere. Also, if it's a div block, nulling the padding can help.