Solved

Can't get image to exact bottom of cell

Posted on 2012-03-31
5
165 Views
Last Modified: 2012-04-04
Hello Experts.

I have a banner image 148 px tall to be displayed in a table cell.  I want the image in this cell/row to be vertically adjacent to the pixels of the cell/row beneath it. Both Firefox and Chrome are showing that the inspected cell/row has a height that is being "calculated" at 151px.   This leaves an annoying 3px space between rows.

Everything I'm doing with border-collapse=collapse; or HTML cell spacing/padding or alignment is not having any effect.

Advice?
0
Comment
Question by:Kimberly_B
5 Comments
 
LVL 16

Expert Comment

by:MikeMCSD
ID: 37791822
Did you trying settting the Vertical align property of the row beneath the image to "top"?
0
 
LVL 7

Expert Comment

by:designatedinitializer
ID: 37793636
Table cells will accomodate in order for the sum of all rows add up to the table height.
Maybe there is content missing in subsequent table rows, and this particular row gets taller.
You have to ask yourself these 2 questions:
1. Is cellpadding & cellspacing & border = 0?
2. How is the height of table cells in this row being specified?
0
 
LVL 16

Expert Comment

by:HagayMandel
ID: 37799710
Add vertical-align: bottom; to your image css, and don't assign height to the table's row.
0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 37805311
Because images are considered 'inline' elements, a space is added after the image. This is by design. Try setting your images to display:block or display: inline-block and it will remove the space.

img { display:block; }

img {display: inline-block; }
0
 

Author Closing Comment

by:Kimberly_B
ID: 37807863
Yay!

This worked in my CSS:  img { display:block; }


img {display: inline-block; } did not work.  Don't know why.  FYI.

Thank you!  Brilliant solution!

(thank you also to the other responses.  None of them worked, but thanks anyway)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

860 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