I use <button> to submit a request on the form. I also created a a.button just like <button> (I need a.button to do some JS stuff).
The button has padding, a fixed height. When I specify the width of the / a button, they look the same. But when I add the width to <button> , it ignores the addition.
I have this problem in Chrome, Firefox and Opera, so I think this is not a rendering error. Also the same problem with <input type="submit" />
Here is the basic CSS:
.button, button { margin: 0; display: inline-block; border: 0; text-decoration: none; cursor: pointer; color: black; background: #ddd; font: 12px Verdana; padding: 40px; text-align: center; }
HTML:
<a href="#" class="button">Some text</a> <button>Some text</button> <br /><br /> <a href="#" class="button" style="width:200px">Some text</a> <button style="width:200px">Some text</button>
Fiddle: http://jsfiddle.net/9dtnz/
Any suggestions on why browsers ignore padding? (top and bottom when using height / left and right when using width).
css padding width rendering
js-coder
source share