ctangent
asked on
How do I fix bottom alignment of an image in a table cell in IE?
I have an image in a table cell I want to align to the very bottom. But in IE 7, there is a single line of the background color that appears underneath the image - it is 1 pixel away. I've set margin-bottom, padding-bottom on image and vertical-align:bottom on cell but still doesn't work .Cell padding/spacing is 0 on table.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
This seems to have a spacing [ ] in your code. or your have a <p> tag or <h1> tag with that images. Please remove any paragraph or header tag around image tag.
your html should look like below;
your html should look like below;
<table>
<tr>
<td>
<img src="" /> // There should be no other tags around this line....
</td>
</tr>
</table>
actually, I wouldn't have any space around the image tag, even a new line as shown in sajay_j example can create gaps. Try the first method I've shown - good luck
you could also set on the table cell in question the following css and html to make the image gravitate to the end of that cell
<td class="test"></td>
.test {
position:relative;
height:100px; //set to what you need
}
.test img{
position:absolute;
bottom:0;
}