Solved

How do I fix bottom alignment of an image in a table cell in IE?

Posted on 2008-06-12
4
231 Views
Last Modified: 2013-12-08
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.
0
Comment
Question by:ctangent
  • 3
4 Comments
 
LVL 10

Accepted Solution

by:
bluefezteam earned 500 total points
ID: 21771853
sounds like there may be whitespace in your code, make sure in the HTML code where your image is, theres no line break or space between the tablecell
Like this
<td><img src="image.jpg" /></td>


as this...
<td><img src="image.jpg" /> </td>
or
<td>
<img src="image.jpg" />
</td>

can produce gaps in IE.
0
 
LVL 10

Expert Comment

by:bluefezteam
ID: 21771876
just make sure all the code is flush to each other, no spaces where one tag ends and another meets.

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;
}
0
 
LVL 4

Expert Comment

by:sajay_j
ID: 21776173
This seems to have a spacing [ &nbsp; ] 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;
<table>
<tr>
<td>
<img src="" /> // There should be no other tags around this line....
</td>
</tr>
</table>

Open in new window

0
 
LVL 10

Expert Comment

by:bluefezteam
ID: 21776668
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
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question