html - How come padding is not calculated into the width for submit buttons? -
html - How come padding is not calculated into the width for submit buttons? -
first of all, think absolutely ridiculous padding considered part of width of dom element.
however, gritted teeth , accepted fact... find out submit buttons paddings not calculated part of width.
http://jsfiddle.net/cpryb/2/
how go fixing this?
i'm not sure if misspoke, padding not considered part of width default. say, if element has width of 100px, padding of 10px, , border of 5px, rendered on 100+(10*2)+(5*2)=130px. however, element contain 100px of space, amount set in width
.
that beingness said, can alter default behavior box-sizing
property. set border-box
subtract padding (and border) box's width, or content-box
render padding outside of specified width. here's a demo.
for increased compatibility should include vendor prefixes. so,
input[type=button] { -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box; }
html css
Comments
Post a Comment