S
Søren Jacobsen
Hi All,
When styling a button with css, I have a problem controlling the button's
left and right padding. If I do nothing, it seems to compute the padding
relative to how much text the button contains. I want a certain, fixed
amount of padding on either side of my button text, so naturally I try to
set this like the following:
button{
padding-left:5px;
padding-right:5px;
}
<button type="submit" value="none">This is a long text</button>
However, what happens is just that the padding is added to the already
existing padding. In other browsers like Opera and Moz this problem does not
exist. The only solution i have is setting a specific width on the button,
but this is really not very elegant. Does anybody have an explanation? Or
even better, a more elegant solution?
Regards,
Søren
When styling a button with css, I have a problem controlling the button's
left and right padding. If I do nothing, it seems to compute the padding
relative to how much text the button contains. I want a certain, fixed
amount of padding on either side of my button text, so naturally I try to
set this like the following:
button{
padding-left:5px;
padding-right:5px;
}
<button type="submit" value="none">This is a long text</button>
However, what happens is just that the padding is added to the already
existing padding. In other browsers like Opera and Moz this problem does not
exist. The only solution i have is setting a specific width on the button,
but this is really not very elegant. Does anybody have an explanation? Or
even better, a more elegant solution?
Regards,
Søren