dave
dave

Reputation: 15459

Why is that when float is specified to the clear div, its parent container's border does not recognize it?

example:

Html

<div id = parent>
      <div class = "clearDiv"></div>
</div>

css:

div.clearDiv
{
      width:      1000px;
      height:     1px;
      float:      left;
      clear:      both;
      visibility: hidden;
}

with the float: left property specified, its parent div does not recognize it, the therefore the parent div #parent has a height that is pretty much zero, why?

Upvotes: 1

Views: 251

Answers (1)

Robert Koritnik
Robert Koritnik

Reputation: 105029

Set overflow:auto; CSS style to parent container element.

To parent container they don't provide dimensinal infomation. They just interact with their siblings (or other floated elements). Hence float. They can be anything, anywhere and of any size. Container doesn't really care because they're floating...

Upvotes: 3

Related Questions