Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS: Basic layout question - keeping nested elements inside each other
    primarykey
    data
    text
    <p>I keep finding that if I have nested divs inside each other, and one of the inner ones is floated, the outer one won't expand around it.</p> <p>Example:</p> <pre><code>&lt;div style='background-color:red; '&gt; asdfasdf &lt;div style='float:left; background-color:blue; width:400px; height:400px;'&gt; asdfasdfasdfasdfasdfasdfasdf&lt;br /&gt; asdfasdfasdfasdfasdfasdfasdf&lt;br /&gt; asdfasdfasdfasdfasdfasdfasdf&lt;br /&gt; asdfasdfasdfasdfasdfasdfasdf&lt;br /&gt; asdfasdfasdfasdfasdfasdfasdf&lt;br /&gt; asdfasdfasdfasdfasdfasdfasdf&lt;br /&gt; asdfasdfasdfasdfasdfasdfasdf&lt;br /&gt; asdfasdfasdfasdfasdfasdfasdf&lt;br /&gt; asdfasdfasdfasdfasdfasdfasdf&lt;br /&gt; asdfasdfasdfasdfasdfasdfasdf&lt;br /&gt; asdfasdfasdfasdfasdfasdfasdf&lt;br /&gt; &lt;/div&gt; asdfasdf &lt;/div&gt; </code></pre> <p>What do I need to do to the outer div to make it cover the inner one? IE: Put it's border/background color all the way around it?</p> <p>Also, is there a general principle I am bumping up against here? If so, what should I look up to get a solid understanding of what it is?</p> <p>Thanks!</p> <p><strong>Edit</strong></p> <p>Hi All, </p> <p>Thanks for the answers, semantically correct and no, and for the links.</p> <p>Though I will end up using overflow in the final work, I will leave Ant P's answer as accepted, as it was the first one that really worked, and got me out of a short term jam, even though it offends semantic sensibilities.</p> <p>As a long-time html hack trying to move to decent css layouts, I can certainly understand, and sympathize with, using semantically incorrect hack that gets the job done, though I am sure he will change that habit after this =o)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload