Results 1 to 2 of 2

Thread: background image in table <td> different in IE and Firefox

  1. #1
    Join Date
    Aug 2009
    Posts
    7

    background image in table <td> different in IE and Firefox

    Hello,

    I have this php code :

    PHP Code:
    //echo $i."<br>end-".$end."-start-".$start;
               
    echo "<table bgcolor=#666666 bordercolor=#C0C0C0 border=0 width=700 cellspacing=0 cellpadding=10><tr><td background=\"images/topbar.gif\" height=\"45\"></td></tr><tr><td>";
                echo 
    "<b>$listDatetxt: </b>";
            
    $lines[$i]->showDate();
        echo 
    "<br><b>$listnametxt: </b>";
            
    $lines[$i]->showFrom();
            echo 
    "</a><br><br><b>$listMessagetxt: </b>";
            
    $lines[$i]->showMessage();
        echo 
    "</td></tr>
        <tr><td background=\"images/footbar.gif\" height=\"30\"></td></tr></table><br>"
    ;
    }

    echo 
    "<center>"
    This is the problem :

    In Firefox the table is shown correctly, except that text is not centered
    In IE text is centered but the background images (topbar and footbar) seam to be ‘repeated’ in the in the imagebar.
    Sizes of my images :
    topbar.gif 700x45
    footbar.gif 700x30
    So obviously I am doing something wrong (newbee !)
    Someone can help me ?

    Thanks

  2. #2
    Join Date
    Oct 2009
    Posts
    64
    My guess as to the cause is the cellpadding being 10... but as to the solution...

    I would use (and I write this in plain html rather than php)
    Code:
    <td height="45" style="background-image: url('images/topbar.gif'); background-repeat:none;">
    Then you may also need to assign the position of the background with styles also, depending on what those images are being used for... for instance, if the top one needs to connect to the body of your table then you might need to position it to the bottom of the cell... but at the same time, having it in tables at all will probably present problems if that's what you're trying to do.

Posting Permissions

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