I have a span element inside a button. The span has a background colour but I cannot get it to fill the button in Firefox, it's fine in Chrome and IE.
I've looked at two similar questions but their answers don't seem to fix this for me.
Here's a stripped down version of my problem:
div {
height: 300px;
width: 300px;
background-color: red;
}
button {
padding: 0px;
margin: 0px;
color: inherit;
border: 0px none;
background-color: blue;
}
span {
background-color: yellow;
display: block;
width: 100%;
}
<div>
<button><span>span</span></button>
</div>
Like well explained here: "Firefox adds a special padding
to input
s and button elements."
This actually fix your issue.
http://jsfiddle.net/2fm31sd7/1/
button::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner,
input[type="reset"]::-moz-focus-inner {
padding: 0;
border: 0 none;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With