yogi
yogi

Reputation: 19591

Child divs overflow

I have a parent div inside which I have multiple divs which are children of parent div, But I don't get that why those child divs are overflowing outside the parent div,

I want parent div to adjust it's height according to the number of child divs inside it.

Heres the fiddle

Upvotes: 0

Views: 94

Answers (4)

Artyom
Artyom

Reputation: 1599

overflow: hidden will make the overflowing child content simply hidden, which, I believe, is not what you are trying to achieve.

To expand the parent div to show all child content, either specify overflow: auto on the parent (may have side effects in some browsers), or put

<div style="clear: both"></div>

as the last child in your parent div.

Upvotes: 0

Tomer
Tomer

Reputation: 17930

Either float #downloads left, or use overflow:hidden:

#downloads
        {
            background-color: #EEEEEE;
            border: 1px solid #CCCDCF;
            padding: 5px;
            line-height: 25px;
            overflow:hidden;
        }​

or:

#downloads
        {
            background-color: #EEEEEE;
            border: 1px solid #CCCDCF;
            padding: 5px;
            line-height: 25px;
            float: left;
        }​

Upvotes: 1

SVS
SVS

Reputation: 4275

Just make overflow:hidden instead of overflow:visible

Demo

Upvotes: 1

Andy
Andy

Reputation: 14575

Float #downloads left.

http://jsfiddle.net/CvMNH/1/

Upvotes: 1

Related Questions