According to the answers below: this is best the solution: .text { line-height: 15px; } input::-moz-focus-inner {border:0; padding:0; margin-top:-1px; margin-bottom:-1px;} Thank you all.
I know that there are some similar questions on Stackoverflow. Because none of the answers works for me, and I have been researching this issue for almost a week but no luck, I decide to post this question. Please help.
Lets say I have a submit button and a text box, Firefox always adds 2px extra padding inside the elements, I tried many solutions I found on the net but none of them works.
Test the code here: https://jsfiddle.net/4f2duwud/7/
HTML:
<form action="http://google.com">
<input type="submit" class="submit" value="Go to Google">
<input type="text" class="text">
</form>
CSS:
a.button {
-webkit-appearance: button;
-moz-appearance: button;
appearance: button;
text-decoration: none;
color: initial;
}
.text {
padding:3px;
border: 1px solid gray;
}
.submit {
padding:3px;
border:1px solid gray;
}
input[type="reset"]::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner,
input[type="text"]::-moz-focus-inner,
input[type="file"] > input[type="button"]::-moz-focus-inner {
border:0 !important;
padding:0 !important;
}