-1

Possible Duplicate:
Using TABLES and INCLUDES

I'm trying to to a simple page organized with various PHP includes inside tables.

My problem is: when I put a <?php include('header.php');?> in <td>of the tables it creates a space between them.

Here is the test page that I'm trying to do: http://www.dmaispublicidade.pt/_dmaisprojecto

Is a index.php with a table calling others .php files (that even have tables and other includes)?

This white spaces between images it supposes to not be there!

Can anybody help?

Example of index.php:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>d+ projecto</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="css/estilos.css" rel="stylesheet" type="text/css">
    </head>
    <body><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr align="center">
                <td><?php include('header.php'); ?></td>
            </tr>
            <tr align="center">
                <td><?php include('corpo.php'); ?></td>
            </tr>
            <tr align="center">
                <td><?php include('footer.php'); ?></td>
            </tr>
        </table>
    </body>
</html>

Example of header.php:

<table width="950" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td><img src="imagens/provisorio/header.jpg"/></td>
    </tr>
</table>

Example of the css (that is called inside de head of index.php):

@charset "utf-8";
body {
    margin: 0px;
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}

When we saw the source code in the test page, we can saw that is inserting (I don't know how) a TBODY in the document; I don't know why. Is there something to remove the TBODY by CSS?

Brian Tompsett - 汤莱恩
  • 5,195
  • 62
  • 50
  • 120
Marcelo
  • 3
  • 3
  • By "the source code" do you mean "a serialisation of the DOM as rendered by a tool like Firebug"? And we heard you the first time, don't repeat questions. And don't use tables for layout. – Quentin May 06 '11 at 19:23
  • For some reason after inspecting the element between there is a "" - which suggest a whitespace? eof character? there is something comming back with the include possibly that is making that space appear. Tables in tables in tables.......
    – Piotr Kula May 06 '11 at 19:46

2 Answers2

-1

The problem is you have a space at the start of header.php.

Remove that and you should be fine.

Oliver Emberton
  • 944
  • 4
  • 13
  • :( no, is not that. there is no space. is the php include is putting a space between images, but there is not a break spaces. :( thks anyaway – Marcelo May 06 '11 at 17:04
  • Just check there isn't a linebreak or something around the `` tags. I've done this before by mistake. – Oliver Emberton May 06 '11 at 17:09
  • no. theres is not any spaces. When we saw the source code in the test page, we can saw that is inserting (i dont know how) a TBODY in the document :S i dont know why. There is someting to remove the TBODY by CSS? – Marcelo May 06 '11 at 19:09
-1

In header.php add a <br> after the <img> tag:

<table width="950" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td><img src="imagens/provisorio/header.jpg"/><br></td>
    </tr>
</table>

I'm not sure why but this seems to clear img / td spacing on some browsers.

Chad
  • 218
  • 1
  • 4