Solved

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

Posted on 2008-06-12
4
229 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wrapper for APPs 9 76
Changing way home page shows 2 29
Browser Chrome downloads colored link 5 40
Botom of page is wrong color 5 10
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

776 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