Click to See Complete Forum and Search --> : Auto div height ignores images?


bldstr
11-28-2008, 09:54 AM
I have several divs on a page all containing text and an image and each div has a bottom border on it. The div height is determined by the text but it doesn't seem to take images into account?

Here is the page in question (http://www.buildstore.co.uk/test/whyselfbuild/self-build-products-services.html).

I thought floating all the divs left and clearing the floats might fix it but apparently not. Is there any way of getting divs to recognise the height of the images and not cause them to overlap?

sticks464
11-28-2008, 10:53 PM
Do away with the left floats on the div's. Give each div it's own class, put your image inside the h2 tag and float the image left.

EX:
h1 {
margin-left:210px;
}
.imgrightpad {
margin-right: 10px;
margin-bottom:5px;
float: left;
margin-bottom:20px;
}
.box {
border-bottom:solid 1px #000;
margin-top:20px;
height:150px;
padding-bottom:10px;
}
.box1 {
border-bottom:solid 1px #000;
margin-top:20px;
height:177px;
padding-bottom:10px;
}
.box2 {
border-bottom:solid 1px #000;
margin-top:20px;
height:170px;
padding-bottom:10px;
}
.box3 {
border-bottom:solid 1px #000;
margin-top:20px;
height:285px;
padding-bottom:10px;
}


<h1>BuildStore Products and Services </h1>
<div class="box">
<h2><a href="/findingland/default.aspx?sid=sb"><img src="images/land_for_sale.jpg" alt="PlotSearch Land finding service in the uk" width="196" height="150" class="imgrightpad" /></a>Land for sale in your area? Renovations &amp; Conversions for sale?</h2>
<p><a href="/findingland/default.aspx?sid=sb">PlotSearch</a> is the UK's premier self build land finding service, listing details of thousands of genuine building plots and renovation opportunities, UK-wide.We gather plot and property details from thousands of sources including estate agents and private sellers daily, making PlotSearch the single biggest database of self build land available. From only &pound;29, you can have full access to our database and the support of our dedicated PlotSearch team. </p>
<p><a href="/findingland/default.aspx?sid=sb">Find out more about PlotSearch and see the number of available plots on your area here...</a></p>
</div>
<div class="box1">
<h2><a href="/finance"><img src="images/fshomepage.jpg" alt="Self Build Finance" width="200" height="177" class="imgrightpad" /></a>Self Build Finance &amp; Insurance </h2>
<p>If you are thinking about building your own home, renovating, converting or doing a major project on your existing property, BuildStore is the number one choice for financial assistance. Arranging your self build, renovation or home improvement finance with BuildStore is simple and straightforward. </p>
<p><a href="/finance">Find out more about our finance options and apply online... </a></p>
</div>
<div class="box2">
<h2><a href="/materials"><img src="images/tradecard.gif" alt="Trade Card" width="190" height="170" class="imgrightpad" /></a>The BuildStore Trade Card </h2>
<p>Whatever your project involves, Buildstore Trade Card is the smart way to buy building materials and supplies. Membership of Trade Card offers self builders and renovators products and services at trade or discounted prices and other special benefits. </p>
<p>We partner with many of the UK&rsquo;s top merchants, manufacturers and suppliers to offer you choice &amp; value.
Because we specialise in working with self builders and renovators we understand your needs and offer you expert support and advice at every stage of your project. <a href="/materials">Find out more... </a></p>
</div>
<div class="box3">
<h2><a href="/mykindofhome"><img src="images/coupleatnsbrc.jpg" alt="the netional self build and renovation centre" width="190" height="285" class="imgrightpad" /></a>The National Self Build &amp; Renovation Centre </h2>
<p>BuildStore&rsquo;s National Self Build &amp; Renovation Centre in Swindon is the UK&rsquo;s ONLY permanent centre for self builders &amp; renovator&rsquo;s - simply a must see at whatever stage of self build, conversion or renovation you are! </p>
<p>Walk through two permanent houses, view cut-away foundations, floors, roofs, septic tanks and much, much, more. See the latest products to enhance your home or renovation project including lighting, sound systems, kitchens and flooring - there are <strong>240+ suppliers in the Trade Village.</strong></p>
<p>The Visitor Centre is situated just off the M4 (J16) near Swindon. Open Monday, Thursday, Friday , Saturday &amp; Sunday every week. Most months there is a special event or celebrity speaker in the centre.</p>
<p><a href="/mykindofhome/movie.html">See what others thought of the most recent event on video here...</a></p>
<p><a href="/mykindofhome">Or visit the homepage here...</a></p>
</div>