Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between Firefox and Chrome padding

Tags:

css

there is a difference in how firefox and chrome render the padding in css. what appears correct in chrome is extra padded in firefox. is there a way to solve?

.button {
    font-family: helvetica, arial;
    font-size: 64px;
    width: 70px;
    height: 45px;
    font-weight: bold;
    padding: 0px;
    padding-top: 25px;
    background-color: #000;
    color: #fff;
    text-align: center;
    float: right;
    margin: 7px 10px 0 0;
}
like image 379
amit Avatar asked Mar 20 '11 18:03

amit


People also ask

Is Firefox smoother than Chrome?

Is Firefox Faster Than Chrome? No, Chrome is significantly faster and more memory-efficient than Firefox. Is Firefox Really Better Than Chrome? Firefox is a more private and secure browser than Chrome, but Chrome is faster and contains more features.

Is Firefox more RAM efficient than Chrome?

Stop running out of memoryChrome uses up to 1.77x more memory than Firefox. If your computer is already low on memory, this can cause a significant slowdown.

Does Firefox have better privacy than Chrome?

Firefox's default privacy settings are more protective than those of Chrome and Edge, and the browser has more privacy options under the hood, too.

What is the difference between height and padding?

height controls the actual height of the element (basically the distance from border-bottom to border-top ) whereas padding controls the distance between the content and the border.


3 Answers

If your .button is a button this might be a mozilla inner focus thing... try this?

.button::-moz-focus-inner { border: 0; padding: 0; margin:0; }
like image 177
superUntitled Avatar answered Oct 02 '22 15:10

superUntitled


Firefox and Chrome render padding exactly the same way. Your problem is elsewhere.

Are you using a reset CSS? If not, the default line-height declaration might be interfering with the rendering of your button.

For one, your height is way smaller than your font-size. Since you don't have overflow specified, your height will always be extended to at least font-size (or whatever your line-height specifies).

If your .button class is actually a <button> element, also apply superUntitled fix.

like image 25
Andrew Moore Avatar answered Oct 02 '22 16:10

Andrew Moore


The focus-inner fix works but I also add negative top and bottom margins to get it to the right height. e.g.:

*::-moz-focus-inner {
padding: 0;
border: 0;
margin-top:-1px;
margin-bottom:-1px;
}

I used to love Firefox, but it has become a bloated mess and fell off my Christmas list years ago.

like image 29
Kirk Ross Avatar answered Oct 02 '22 15:10

Kirk Ross