Chang Huang wrote:

> 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?

For your calculations to work as intended within the W3C box model in
compliant browsers now, you must use percentages on both size and
padding for #box2 and make them add up to 100% of #box1.

Something like:

#box2 { width:96%; height:90%; padding:5% 2%; }

(It's a case for CSS table, me thinks.)


You'll (probably) be able to let the browsers subtract 10px padding from
100% size and then add the padding, some day in the future...
<http://www.w3.org/TR/css3-values/#calc>
...but for now you'll have to do those calculations yourself before
entering them into CSS.

regards
        Georg
-- 
http://www.gunlaug.no
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to