<div id=\"box1\"> <div id=\"box2\"> </div></div>
#box1 { width:500px; }#box2 { width:100%; padding:10px; }
#box1 { width:500px;}#box2 { padding:10px;}
"chazzwick" said:Why do you want to keep the width of box2 in % when its fixed at 500px because of box1?
and I do:
#box1 { width:500px; }#box2 { width:100%; padding:10px; }
The 10px padding of #box2 will be allocated outside of #box1. According to the box model, this is the correct behavior (except for buggy IE6). But that is not what I want, I want the padding for #box2 remain inside #box1 and keeping the width in %.
How can I do that?
Thanks.
If you want 10px padding inside box1, just have:
#box1 { width:500px;}#box2 { padding:10px;}
So if you change the width of box1 in the future, box2 will automatically expand to fill it completely.
I don't have any example on hand right now, =(