Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 表上空白处_Html_Space - Fatal编程技术网

Html 表上空白处

Html 表上空白处,html,space,Html,Space,当特定浏览器运行此html页面时,我的表格上方有空间: <table> <center> <tr><th width="150" scope="col"> 5/28 - 5:47 PM: <br><br> x <br> x</th> <td width=1000>y </td></tr> <br><br><tr><td>

当特定浏览器运行此html页面时,我的表格上方有空间:

<table>
<center>
<tr><th width="150" scope="col">
5/28 - 5:47 PM: <br><br> x <br> x</th> <td width=1000>y
</td></tr>
<br><br><tr><td>&nbsp;</td></tr>

<tr><th width="150" scope="col">
5/16 - 12:59 AM: <br><br> z <br> z <br>z <br> z</th><td width=1000>y</td></tr>
<br><br><tr><td>&nbsp;</td></tr>
<tr><th width="150" scope="col">
5/10 - 12:34 AM: <br><br>z <br>z<br>z</th><td width=1000>y</td></tr>
<br><br><tr><td>&nbsp;</td></tr>
<tr><th width="150" scope="col">
5/8 - 4:47 PM: <br><br> z <br>z</th> <td width=1000> y</td></tr>
<br><br><tr><td>&nbsp;</td></tr>
</table>

5/28-5:47下午:

x
x

5月16日至12:59上午:

z
z
z
zy

10月5日至12:34上午:

z
z
zy

下午5:8-4:47:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00


如何删除它?

您的代码编辑得不好,您没有关闭
标记。 为了消除表格顶部的多余空间,您应该删除

元素之间的
标记

所以不是

<tr>
    <th width="150" scope="col">
        5/28 - 5:47 PM: <br><br> x <br> x
    </th>
    <td width=1000>y</td>
</tr>
<br><br>
<tr>
    <td>&nbsp;</td>
</tr>

5/28-5:47下午:

x
x Y

你应该

<tr>
    <th width="150" scope="col">
        5/28 - 5:47 PM: <br><br> x <br> x
    </th>
    <td width=1000>y</td>
</tr>
<tr>
    <td>&nbsp;</td>
</tr>

5/28-5:47下午:

x
x Y
此HTML已严重损坏。表内不能有标记或文本,但TR外可以有标记或文本。在该位置可以有诸如CENTER和BR之类的标记。您应该使用一个验证器或一个像样的IDE,这将捕获这些问题

通过一些格式设置,您的代码是:

<table>
    <center> <!-- THIS IS INVALID -->
    <tr>
        <th width="150" scope="col">
            5/28 - 5:47 PM: <br><br> x <br> x
        </th>
        <td width=1000>y</td>
    </tr>
    <br><br><!-- THIS IS INVALID -->
    <tr>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <th width="150" scope="col">
            5/16 - 12:59 AM: <br><br> z <br> z <br>z <br> z
        </th>
        <td width=1000>y</td>
    </tr>
    <br><br><!-- THIS IS INVALID -->
    <tr><td>&nbsp;</td></tr>
    <tr>
        <th width="150" scope="col">
            5/10 - 12:34 AM: <br><br>z <br>z<br>z
        </th>
        <td width=1000>y</td>
    </tr>
    <br><br><!-- THIS IS INVALID -->
    <tr><td>&nbsp;</td></tr>
    <tr>
        <th width="150" scope="col">
            5/8 - 4:47 PM: <br><br> z <br>z
        </th>
        <td width=1000> y</td>
    </tr>
    <br><br><!-- THIS IS INVALID -->
    <tr>
        <td>&nbsp;</td>
    </tr>
</table>

5/28-5:47下午:

x
x Y

16月5日至12时59分:

z
z
z
z Y

5/10-12:34上午:

z
z
z Y

5/8-4:47下午:

z
z Y

最重要的是,您的
CENTER
标记没有结束标记,无论如何,您真的不应该使用CENTER


您的TRs的子元素数量也不一致;有时是一个,有时是两个。这将导致显示不一致,除非对单独的子项使用
colspan=“2”
属性。

哪个浏览器?