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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.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_Css_Html Table - Fatal编程技术网

HTML-关于表格单元格宽度

HTML-关于表格单元格宽度,html,css,html-table,Html,Css,Html Table,在我的网页中,我有以下内容: <table style="width:1000px"> <tr> <td></td> <td style="width:500px"></td> <td></td> </tr> </table> 我可以假设第一个和最后一个单元格的宽度都是250px吗?或者行为应该依

在我的网页中,我有以下内容:

<table style="width:1000px">
     <tr>
         <td></td>
         <td style="width:500px"></td>
         <td></td>
      </tr>
</table>

我可以假设第一个和最后一个单元格的宽度都是250px吗?或者行为应该依赖于浏览器吗

编辑:


我假设第一个和最后一个单元格都是空的

@ammcom到目前为止大家所说的都是正确的。如果您选择该路线并使用显式宽度设置空单元格,请确保在CSS中也设置了该宽度:
table{table layout:fixed;}
这将使表符合您的显式宽度,就像您对两个空列使用50%一样。默认行为是:
表格布局:auto
,它使表格根据单元格内的内容对其宽度进行优先级排序

我认为它们是动态的,这是因为内容。如果你想强制它们每个都是250像素,你需要在css中指定,否则它将取决于内容的宽度,如@DanielCheung所述。表格样式宽度是否有影响?它们是空单元格。你需要明确指定。空单元格不能像那样占据空间。