Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.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 表不包括';t中心位于网站或dreamweaver中_Html - Fatal编程技术网

Html 表不包括';t中心位于网站或dreamweaver中

Html 表不包括';t中心位于网站或dreamweaver中,html,Html,这是我的问题,我正在一个网站上工作,我刚刚从Photoshop导入,将其切片等。现在我需要将整个网站作为一个表格居中,但当我将表格宽度设置为100%时,它根本不起作用 代码如下: <!DOCTYPE html> <head> <title>Design</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <

这是我的问题,我正在一个网站上工作,我刚刚从Photoshop导入,将其切片等。现在我需要将整个网站作为一个表格居中,但当我将表格宽度设置为100%时,它根本不起作用

代码如下:

<!DOCTYPE html>
<head>
<title>Design</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- Save for Web Slices (Design.psd) -->
<table id="Table_01" width="100%" height="1501" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td colspan="3">
            <img src="images/Design_01.gif" width="689" height="210" alt=""></td>
        <td>
            <img src="images/Design_02.gif" width="173" height="210" alt=""></td>
        <td colspan="2">
            <img src="images/Design_03.gif" width="135" height="210" alt=""></td>
        <td colspan="2">
            <img src="images/Design_04.gif" width="209" height="210" alt=""></td>
        <td>
            <img src="images/Design_05.gif" width="1" height="210" alt=""></td>
        <td colspan="6">
            <img src="images/Design_06.gif" width="229" height="210" alt=""></td>
        <td colspan="2">
            <img src="images/Design_07.gif" width="192" height="210" alt=""></td>
        <td colspan="4">
            <img src="images/Design_08.gif" width="214" height="210" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="210" alt=""></td>
    </tr>
    <tr>
        <td colspan="21">
            <img src="images/Design_09.gif" width="1842" height="2" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="2" alt=""></td>
    </tr>
    <tr>
        <td colspan="21">
            <img src="images/Design_10.gif" width="1842" height="161" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="161" alt=""></td>
    </tr>
    <tr>
        <td rowspan="2">
            <img src="images/Design_11.gif" width="48" height="245" alt=""></td>
        <td>
            <img src="images/Design_12.gif" width="74" height="80" alt=""></td>
        <td colspan="17" rowspan="2">
            <img src="images/Design_13.gif" width="1598" height="245" alt=""></td>
        <td>
            <img src="images/Design_14.gif" width="74" height="80" alt=""></td>
        <td rowspan="2">
            <img src="images/Design_15.gif" width="48" height="245" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="80" alt=""></td>
    </tr>
    <tr>
        <td>
            <img src="images/Design_16.gif" width="74" height="165" alt=""></td>
        <td>
            <img src="images/Design_17.gif" width="74" height="165" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="165" alt=""></td>
    </tr>
    <tr>
        <td colspan="21">
            <img src="images/Design_18.gif" width="1842" height="2" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="2" alt=""></td>
    </tr>
    <tr>
        <td colspan="21">
            <img src="images/Design_19.gif" width="1842" height="53" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="53" alt=""></td>
    </tr>
    <tr>
        <td colspan="5" rowspan="10">
            <img src="images/Design_20.gif" width="986" height="504" alt=""></td>
        <td colspan="5" rowspan="2">
            <img src="images/Design_21.gif" width="324" height="29" alt=""></td>
        <td colspan="2" rowspan="6">
            <img src="images/Design_22.gif" width="16" height="230" alt=""></td>
        <td colspan="6">
            <img src="images/Design_23.gif" width="324" height="12" alt=""></td>
        <td colspan="3" rowspan="10">
            <img src="images/Design_24.gif" width="192" height="504" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="12" alt=""></td>
    </tr>
    <tr>
        <td rowspan="4">
            <img src="images/Design_25.gif" width="70" height="205" alt=""></td>
        <td colspan="3" rowspan="3">
            <img src="images/Design_26.gif" width="185" height="161" alt=""></td>
        <td colspan="2" rowspan="4">
            <img src="images/Design_27.gif" width="69" height="205" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="17" alt=""></td>
    </tr>
    <tr>
        <td colspan="2" rowspan="3">
            <img src="images/Design_28.gif" width="105" height="188" alt=""></td>
        <td>
            <img src="images/Design_29.gif" width="115" height="114" alt=""></td>
        <td colspan="2" rowspan="3">
            <img src="images/Design_30.gif" width="104" height="188" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="114" alt=""></td>
    </tr>
    <tr>
        <td rowspan="2">
            <img src="images/Design_31.gif" width="115" height="74" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="30" alt=""></td>
    </tr>
    <tr>
        <td colspan="3">
            <img src="images/Design_32.gif" width="185" height="44" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="44" alt=""></td>
    </tr>
    <tr>
        <td colspan="5" rowspan="2">
            <img src="images/Design_33.gif" width="324" height="15" alt=""></td>
        <td colspan="6">
            <img src="images/Design_34.gif" width="324" height="13" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="13" alt=""></td>
    </tr>
    <tr>
        <td rowspan="4">
            <img src="images/Design_35.gif" width="13" height="274" alt=""></td>
        <td colspan="3" rowspan="2">
            <img src="images/Design_36.gif" width="97" height="146" alt=""></td>
        <td colspan="4">
            <img src="images/Design_37.gif" width="230" height="2" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="2" alt=""></td>
    </tr>
    <tr>
        <td colspan="5" rowspan="2">
            <img src="images/Design_38.gif" width="324" height="217" alt=""></td>
        <td colspan="4" rowspan="2">
            <img src="images/Design_39.gif" width="230" height="217" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="144" alt=""></td>
    </tr>
    <tr>
        <td rowspan="2">
            <img src="images/Design_40.gif" width="3" height="128" alt=""></td>
        <td colspan="2">
            <img src="images/Design_41.gif" width="94" height="73" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="73" alt=""></td>
    </tr>
    <tr>
        <td colspan="5">
            <img src="images/Design_42.gif" width="324" height="55" alt=""></td>
        <td colspan="6">
            <img src="images/Design_43.gif" width="324" height="55" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="55" alt=""></td>
    </tr>
    <tr>
        <td colspan="21">
            <img src="images/Design_44.gif" width="1842" height="323" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="323" alt=""></td>
    </tr>
    <tr>
        <td>
            <img src="images/spacer.gif" width="48" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="74" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="567" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="173" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="124" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="11" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="94" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="115" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="1" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="103" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="13" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="3" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="70" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="24" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="16" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="145" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="47" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="22" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="70" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="74" height="1" alt=""></td>
        <td>
            <img src="images/spacer.gif" width="48" height="1" alt=""></td>
        <td></td>
    </tr>
</table>
<!-- End Save for Web Slices -->
</body>
</html>

设计

将表格宽度设置为100%实际上不会使任何东西居中。 它设置表格以填充所有可用空间(注意滚动条的空间)。
由于表格单元格包含具有定义宽度的图像,因此这些图像为每个表格单元格(以及随后为每个列)定义(最小)宽度 因此,如果屏幕小于图像总数,则需要水平滚动以查看整个结果

通常,如果要使用表格来居中显示内容,嵌套表格是最简单的方法:

<table width="100%">
  <tr>
    <td align="center">
      <table><!-- this is the actual content table -->
        <tr>
          <td>this is my content</td>
        </tr>
      </table>
    </td>
  </tr>
</table>

这是我的内容
希望能有点帮助


还有一个附带说明:大多数人会告诉你,完全从表格创建布局是一种非常古老的时尚<代码>s和CSS可能是一种更好的方法,但我想您是初学者?

谢谢您的回答!是的,我是个初学者,所以我想我会像你说的那样尝试。你能把你的代码插入我的代码吗?那真是太好了!谢谢大家!@EdmBay只需输入您的表格,而不是后面有注释的表格,就可以了。或者将第一行和最后三行前置/追加到代码中。这样会在图像之间创建一个白色间距,并将其打断:(.在这一点上,我希望您插入它,因为我希望尽快完成。虽然这完全可以理解,但在这个平台上非常不鼓励这样做:SO是来帮助您编写代码的,而不是为您编写代码的。为此,有自由职业程序员;-)