Reputation:
See the example here:
http://users.telenet.be/prullen/portfolio.html
I've tried setting my images to display:block -
display: block;
margin: 0;
padding: 0;
but that didn't work.
I also tried adding
visiblity:hidden;overflow:hidden;height:0;font-size:1px;line-height:0px
to the
<div style="clear:both"></div>
but none of these work.
Does anyone know what the cause may be? If possible, clear:both should stay for IE7 compatibility.
Upvotes: 0
Views: 13436
Reputation: 11809
Ok, tested a works.
Remove the clear:both div
and set a float style to the first item.
bad:
<div class="item">
[...]
<div style="clear:both;"></div>
</div>
<div class="item" style="border:red;">
[...]
</div>
good:
<div class="item" style="float:left;">
[...]
</div>
<div class="item" style="border:red;">
[...]
</div>
Upvotes: 1
Reputation: 322
If the gap you're talking about is the vertical gap between the images, then your problem is the top margin on the <p>
in the second .item .description
. It's the element giving the gap.
.description p { margin-top: 0 }
Alternately:
<div class="description">
<p class="first">Description goes here.</p>
</div>
.description .first { margin-top: 0 }
Upvotes: 1
Reputation: 2013
The <p>
tag for the second item is pushing the entire div down by 1 line, because its default top and bottom margins are usually 1em. When you set its margins to zero, then the items will line up right on top of each other. You would want to set <p>
or make a class for <p>
to margin-top: 0px
.
Upvotes: 0
Reputation: 7445
You should add <div style="clear: both;" />
after your first <div>
.
Also you can delete it:
<div style="clear:both;visiblity:hidden;overflow:hidden;height:0;font-size:1px;line-height:0px;"></div>
Upvotes: 0
Reputation: 21
Your paragraph tag is what is causing the gap on top and bottom. The default for paragraphs (in chrome) is:
p {
display: block;
-webkit-margin-before: 1em;
-webkit-margin-after: 1em;
-webkit-margin-start: 0px;
-webkit-margin-end: 0px;
}
simply setting the margin to 0 will fix your problem:
p { margin: 0px; }
Upvotes: 2
Reputation: 2297
Try putting them in a div with a class name '.row', and setting the line height to 0.
HTML:
<div class="row">
<img src="img1.png" />
<img src="img2.png" />
<img src="img3.png" />
</div>
CSS:
.row {
line-height: 0;
}
Upvotes: 4