Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2005
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Regular Coder
    Join Date
    May 2004
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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;
    }

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,253
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #4
    New Coder
    Join Date
    Jul 2005
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #5
    Regular Coder
    Join Date
    Nov 2004
    Location
    The Netherlands
    Posts
    551
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Why don't you set a background image for the cell?
    CATdude about IE6: "All your box-model are belong to us"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •