Whoops forgot to send to list:

Hey Dave,
The container will stretch to fit content that is flow normally in the
document. So far... the article is in normal flow (aka no crazy stuff like
floated or positioned), and left guy is floated. When floated, it breaks out
of normal flow. If you had text in the container, it would move around it,
but to its parent its almost as if floated content doesnt exist so the
border only goes as far as the article which it does know 'exists'.
You can do a few things, some target FF/IE separately. Some work in both but
less elegant.
btw what u want is called Containing or Enclosing Floats.

1. You can add a clearing div inside the container, just be4 the end; it
clears the float from be4. and gives the parent a frame of reference of the
last thing in normal flow to base its borders off of.

2. float the parent. if you float the parent, it will 'contain' its
children. Note the element after the container, needs clear:both applied to
clear the float.

3. add overflow: hidden; or overflow: auto; on parent. Some weird W3 rule
says if u apply this to parent, then it 'contains' its floats.
IE6 doesnt follow this, so It has another rule you can target it with. IE
has an internal property called hasLayout; u can set this to true and
activate some funky stuff. Applying height:1% or height:1px; any dimension
really, zoom:1;, etc gives it layout, and causes IE6 to actually expand to
fit its float children (one of side effects of getting an element's
hasLayout property to be activated).
Can be done like so:
.container{overflow:hidden;} /* for normal browsers like FF*/
* html .container{zoom:1;} /* or use IE conditional comments to target IE
without this '* html' hack which IE6 recognizes */

4. :after solution which i use... new browsers adds a empty, invisible div
automatically just be4 end of container which clears the div. almost like
soluton 1, but without need for non-semantic html tag(aka a tag thrown in
purely for design).

.container:after{ content: "."; display: block; height: 0; clear: both;
visibility:hidden; } /*need a period here just to give some content to put
in document, not sure why "" doesnt work; but everyone recommends just
throwing in a period*/
* html .container{zoom:1;}

Note: To target IE6, i used to use height:1%, or overflow:auto; but i think
there were a few instances where i was throwing a height on some container
to contain its children but i legitimately use overflow with that same
element and then the scrollbars appear, and sometimes i would use overflow
to contain its children but forget that div has a height (causing scrollbars
again). So i use IE propietary CSS prop zoom. which is alright if u dont
mind css stylesheet not validating. if client wants it 100% validated, then
move this specific rule in IE conditional comment.

Hope that helps,
lates,
Ari
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- 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