Piotr,

On Apr 3, 2006, at 11:04 AM, Piotr Zalewa wrote:

> www.nod.pl/js_display_switch.html
>
> My problem is that when I hide a sub div the parent div doesn't change
> his width.

According to the css 2.1 spec floated elements 'shrinkwrap' their 
content.  Therefore the width of #code_explanation depends on whether 
#two is display: block; or display: none; when #code_explanation first 
becomes visible since #two has a width set to 350px.  Clicking 'hide 
code' hides the code, and triggers a document reflow from that point 
_down_ so the width of the float is not recalculated.  I assume this is 
an optimization for speed.  Doing anything to cause a full document 
reflow (such as changing the size of the window, or the font-size via 
the view menu) will cause the width to recalculate and shrink-wrap to 
the visible contents.

-- 
Roger Roelofs
"Remember, if you’re headed in the wrong direction,
        God allows U-turns!"
          ~Allison Gappa Bottke
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to