Many DIVs inside parent DIV, CSS height issue

Posted by Benjamin on Stack Overflow See other posts from Stack Overflow or by Benjamin
Published on 2010-04-20T17:21:10Z Indexed on 2010/04/20 17:23 UTC
Read the original article Hit count: 333

Filed under:

Hi everyone,

I am putting together a dynamic photo gallery and getting stuck trying to place thumbnails. Basically I am trying to place each thumbnail and caption in its own DIV, floated to the left. The thumbnails are working just as I want them to but for some reason the parent DIV refuses to cover the height of the thumbnail area. Here is the CSS I am using..

#galleryBox {
    width: 650px;
    background: #fff;
    margin: auto;
    padding: 5px;
    text-align: center;
}
.item {
    display: block;
    margin: 10px;
    padding: 10px;
    float: left;
    background: #353535;
    min-width: 120px;
    }
.label {
    display: block;
    color: #fff;
}

I have tried height: auto and that hasn't done anything. Here is what I am trying to style:

<div id="galleryBox" class="ui-corner-all">
                <div class="item ui-corner-all">
                    <img src="http://tapp-essexvfd.org/images/ajax-loader.gif" alt="test"/><br/>
                    <p><span class="label">Testing</span></p>
                </div>
                <div class="item ui-corner-all">
                    <img src="http://tapp-essexvfd.org/images/ajax-loader.gif" alt="test"/><br/>
                    <p><span class="label">Testing</span></p>
                </div>
                <div class="item ui-corner-all">
                    <img src="http://tapp-essexvfd.org/images/ajax-loader.gif" alt="test"/><br/>
                    <p><span class="label">Testing</span></p>
                </div>
                <div class="item ui-corner-all">
                    <img src="http://tapp-essexvfd.org/images/ajax-loader.gif" alt="test"/><br/>
                    <p><span class="label">Testing</span></p>
                </div>
                <div class="item ui-corner-all">
                    <img src="http://tapp-essexvfd.org/images/ajax-loader.gif" alt="test"/><br/>
                    <p><span class="label">Testing</span></p>
                </div>
                <div class="item ui-corner-all">
                    <img src="http://tapp-essexvfd.org/images/ajax-loader.gif" alt="test"/><br/>
                    <p><span class="label">Testing</span></p>
                </div>
                <div class="item ui-corner-all">
                    <img src="http://tapp-essexvfd.org/images/ajax-loader.gif" alt="test"/><br/>
                    <p><span class="label">Testing</span></p>
                </div>
            </div>

Thanks!

© Stack Overflow or respective owner

Related posts about css