Solved

Can't get image to exact bottom of cell

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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.
This article discusses four methods for overlaying images in a container on a web page
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 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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now