Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Nested DIVs expansion...

Nested DIVs expansion...
Thread Tools
headbirth
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Aug 29, 2006, 11:24 AM
 
I'm a novice here, but was wondering why one DIV placed inside a parent DIV will not cause the parent to expand when the child's content expands.

So, if I had a container DIV and placed another DIV inside containging some changeable content why is it that the child DIV will expand to accomodate the content, but the parent will not.

Is there something I'm missing?

Thanks!
     
headbirth  (op)
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Aug 29, 2006, 08:16 PM
 
Nevermind ... Overflow seems to have handled it.
     
registered_user
Dedicated MacNNer
Join Date: Nov 2001
Location: Are Eye
Status: Offline
Reply With Quote
Aug 29, 2006, 08:16 PM
 
A unstyled, block-level parent element will expand to fit all of its content so long as the content isn't removed from the document flow. Content may be removed from the document flow by positioning it absolutely or floating it.

So, for example, if your child div is floated, then the parent will not wrap it.
     
headbirth  (op)
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Aug 30, 2006, 09:45 AM
 
Ah ... makes sense. So, how do designers handle layouts with columns floated left or right? Is it just a matter of adjusting the parents margins, padding etc... to give the illusion that the child fits?
     
Millennium
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Aug 30, 2006, 12:02 PM
 
Originally Posted by headbirth
Ah ... makes sense. So, how do designers handle layouts with columns floated left or right? Is it just a matter of adjusting the parents margins, padding etc... to give the illusion that the child fits?
That's the usual method of doing things. You can also use the CSS display:table-* properties to get table-like behavior, but those don't work in IE.

A real shame, too, given that those properties are the answer to getting full table-like columns and such in CSS. Everyone but IE supports them now, but without IE support they're non-starters.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 12:48 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,