Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Css - 1 px difference in Firefox when creating a button

Tags:

css

firefox

You can see the problem in Jsfiddle

This is my code:

CSS

   .btn {
    text-align: center;
    color: #333;
    font-weight: 700;
    font-size: 11px;
    font-family: tahoma, verdana, arial, helvetica;
    background: -webkit-linear-gradient(#fefefe, #e7e7e7);
    background: -o-linear-gradient(#fefefe, #e7e7e7);
    background: -moz-linear-gradient(#fefefe, #e7e7e7);
    background: linear-gradient(#fefefe, #e7e7e7);
    height: 24px;
    width: auto;
    overflow: visible;
    border: 1px solid #c4c4c4;
    padding: 0 10px;
    line-height: 22px;
    border-radius: 3px;
}
.btn:hover {
    color: #111;
    border: 1px solid #555;
}

HTML

<input type="submit" value="Submit" class="btn" />

This button looks OK in Chrome, Opera, MIE but not in Firefox.

In all browsers, the space above and below the "Submit" text is 7px and 7 px.

In Firefox - 8px and 6 px.

Is there any way to fix this problem in Firefox?

enter image description here

like image 968
Gigante Avatar asked Nov 13 '15 17:11

Gigante


1 Answers

Add the following CSS to reset the padding and border properties for your element.

Updated JSFiddle: http://jsfiddle.net/r5vvac82/1/

.btn::-moz-focus-inner {
    padding:0;
    border:0;
}
like image 121
My Stack Overfloweth Avatar answered Oct 24 '22 21:10

My Stack Overfloweth