Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-20-2005, 11:06 AM   PM User | #1
sparks80
New Coder

 
Join Date: Jul 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
sparks80 is an unknown quantity at this point
Excess space displaying in a firefox table

I have a fairly simple request that has been bothering me for some time. I have a table with an image as the title, the rest of the data follows a basic tabular format so using a table seems most appropriate. I have set the image in its own table row and within appropriate tags, however no matter what I do firefox will always display the image with an additional 2 pixels at the bottom of the image.

I have tried explicitly setting the table height and width, using style sheets to set height, width, margins and padding, and the table itself is set with no cellpadding or cellspacing.

Does anyone have any thoughts as to what is going on?

I am only getting this error in firefox 1.04 running on an XP box, it displays normally under IE6. I have included the code (pretty simple).

Cheers, Mark

Code ....

<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0>

<!-- ******************** titlebar ********************-->
<TR>
<TD STYLE="height:42px;padding:0px;margin:0px;"><IMG SRC="title.jpg" HEIGHT="42" WIDTH="1085" BORDER="0"></TD>
</TR>

Last edited by sparks80; 07-20-2005 at 11:10 AM..
sparks80 is offline   Reply With Quote
Old 07-20-2005, 12:05 PM   PM User | #2
Span
Regular Coder

 
Join Date: May 2004
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Span is an unknown quantity at this point
Basically, images are inline elements like text. They are sitting on the baseline.

There are two ways to get rid of the space.

img {
vertical-align:bottom;
}

or:

img {
display:block;
}
Span is offline   Reply With Quote
Old 07-20-2005, 12:41 PM   PM User | #3
ronaldb66
Senior Coder

 
Join Date: Jun 2002
Location: The Netherlands, Baarn, Ut.
Posts: 4,253
Thanks: 0
Thanked 0 Times in 0 Posts
ronaldb66 is an unknown quantity at this point
Image as title?

Added to that, I don't think including a title image in a regular cell is such a good idea; if you're game, you could give the caption element a try. I can hold inline content, so images are in as well.
__________________
Regards,
Ronald.
ronaldvanderwijden.com
ronaldb66 is offline   Reply With Quote
Old 07-20-2005, 08:22 PM   PM User | #4
sparks80
New Coder

 
Join Date: Jul 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
sparks80 is an unknown quantity at this point
Many thanks

Thank you for your suggestions. That has worked beautifully. Does anyone know of the reason it is poor practice to use an image inside a table?

I am guessing this has something to do with cross-browser support, and everyones favourite argument as to which is better for layout: DIVs or TABLEs.
sparks80 is offline   Reply With Quote
Old 07-21-2005, 10:43 AM   PM User | #5
mrruben5
Regular Coder

 
Join Date: Nov 2004
Location: The Netherlands
Posts: 551
Thanks: 0
Thanked 0 Times in 0 Posts
mrruben5 is an unknown quantity at this point
Why don't you set a background image for the cell?
__________________
CATdude about IE6: "All your box-model are belong to us"
mrruben5 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:39 AM.


Advertisement
Log in to turn off these ads.