Solved

Can't get image to exact bottom of cell

Posted on 2012-03-31
5
164 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

803 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