how can I modify these divs so that when I change their padding, their height and width do not expand? I have tried to implement
.outer, .inner {
display: block;
}
.outer {
/* specify fixed width */
width: 300px;
padding: 0;
}
.inner {
/* specify padding, can be changed while remaining fixed width of .outer */
padding: 5px;
}
from here
by giving the parent divs fixed_width
and relative_container
width:700px;height:100px; padding:0px;
, but when I apply padding to .content
or .obscure
, the divs expand to cover .extra_margins below
. Thanks!
http://jsfiddle.net/loren_hibbard/ZmJ9R/
You can use CSS3 box-sizing
property to do this:
box-sizing: border-box;
http://css-tricks.com/box-sizing/
Supported in IE8+ but some browsers may require a prefix:
http://caniuse.com/css3-boxsizing
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