views:

542

answers:

2

See http://www.martenminkema.nl

The layers of each entry only gain the height of the text that it contains. The height of the image isn't taken into account, resulting into troubles with some layout markup in some cases.

html:

<div id="entry-296" class="hentry entry gedachten">
<a href="http://www.martenminkema.nl/gedachten/2009/06/autobahnbar-1.html" rel="bookmark"><span class="date">12.06.09</span></a><h2 class="entry-title"><a href="http://www.martenminkema.nl/gedachten/2009/06/autobahnbar-1.html" title="Geplaatst onder Gedachten op 12 juni 2009 23:32 in de categorie(&euml;n): buitenland, met de volgende tags: berlijn">Autobahnbär</a></h2><div class="icoontje" title="Gedachten"><div class="linkwrapper transparent"><a href="http://www.martenminkema.nl/gedachten/2009/06/autobahnbar-1.html" class="clickable">&nbsp;</a></div></div>
<div class="entry-content">
<a href="http://www.martenminkema.nl/gedachten/Afbeeldingen/Autobahnb%C3%A4r-in-Berlijn.jpg" rel="lightbox" title="Beer aan de snelweg in Berlijn (foto: M. Minkema)"><img src="http://www.martenminkema.nl/gedachten/assets_c/2009/06/Autobahnbär-in-Berlijn-thumb-150xauto.jpg" width="150" height="112" alt="" class="icoon"/></a>
Beer met uitzicht, Tierpark Berlin op een vroege ochtend.</div>
</div>

css:

div.entry {
clear: both;
display: block;
font-size: 12px;
margin-bottom: 10px;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
padding-bottom: 0px;
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
position: relative;
text-align: left;
width: 350px;
}

a[rel='lightbox'] {
color: black;
cursor: auto;
display: block;
font-size: 12px;
font-weight: bold;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 200px;
margin-top: 0px;
padding-bottom: 0px;
padding-left: 0px;
padding-right: 0px;
padding-top: 0px;
text-decoration: none;
width: 150px;
}

The lightbox link contains the image. The image height is given in the html, but according to my safari webdevelopment tools, the lightbox link doesn't gain the height of the image, resulting in that the div.entry layer only gets the height of the text and the image height isn't taken into account.

Any solution to that?

Thanks!

A: 

Your question is a bit unclear but gathering from experience you have an image inside your DIV that is floated to the left.

You can use a popular technique called the clearfix to make sure the outer DIV is the same height as the text and the image inside it.

Looking at the site you mention you can solve this as follows (notice i added the "clearfix" class):

<div class="entry-content clearfix">
<a href="...">
<img class="icoon" width="150" height="147" alt="" src="..."/>
</a>
Sommige verkeersborden krijgen een totaal andere lading als je ze een stukje kantelt.
</div>

The clearfix CSS code and an article that explains your problem can be found here:

http://www.positioniseverything.net/easyclearing.html

Michiel
Thanks! overflow: hidden did the trick. Seems to be cross-browser too.Sorry if my question wasn't clear enough though..Only one strange thing: it seems that there's an extra 10px padding at the bottom of each div.entry now. I had margin-bottom: 10px for each entry, but with overflow: hidden, the space between two is 20px. Taking out the margin-bottom makes it 10px again, but this isn't happening in IE. So I'm wondering where the 10px padding suddenly comes from.Tnx again
Welcome to the wonderful world of web dev and the special, ego-centric, way IE interprets CSS :-D
Itay Moav
Padding is usually a bit safer than margins, you might try that instead.
Michiel
+1  A: 

give the div overflow: hidden and make sure the DIV has a width.

Itay Moav
wouldn't this create unexpected results?
Michiel
not if the div has a set width. He will then simply contain all the elements inside him.
Itay Moav