Solved

Can't get image to exact bottom of cell

Posted on 2012-03-31
5
166 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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 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.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
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…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

726 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