Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.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/9/blackberry/2.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
Css 表布局:固定问题_Css_Tablelayout - Fatal编程技术网

Css 表布局:固定问题

Css 表布局:固定问题,css,tablelayout,Css,Tablelayout,我有一个表格,表格布局固定。表中有两列 如果我为第一行设置colspan=2,那么剩余的行显示相同的宽度。(它没有采用我指定的宽度。) 小提琴 10000 1066fdg 10 是否仍要为其余行设置指定的列宽?这是因为固定表布局由第一行或列定义驱动-请尝试此操作 <table style='table-layout:fixed' border="1" width="100%"> <col width="5%" /> <col width="95%" />

我有一个
表格
,表格布局固定。表中有两列

如果我为第一行设置
colspan=2
,那么剩余的行显示相同的宽度。(它没有采用我指定的宽度。)

小提琴


10000
1066fdg
10

是否仍要为其余行设置指定的列宽?

这是因为固定表布局由第一行或列定义驱动-请尝试此操作

<table style='table-layout:fixed' border="1" width="100%">
<col width="5%" />
<col width="95%" />
<thead>
<tr>
<th colspan='2'>10000</th>
</tr>
<tr>
<th>1066fdg</th>
<th>10</th>
</tr>
</thead>
</table>

10000
1066fdg
10

您在
th
上设置了一个宽度,为什么不在样式表中设置一个类,为
th
tr
行提供所需的宽度?

试试这个

<table style='table-layout:fixed' border="1" >
<col width="5%" />
<col width="95%" />
<thead>
<tr>
<th colspan='2'>10000</th>
</tr>

<tr>
<th>1066fdg</th>
<th>10</th>
</tr>
    <tr><th>&nbsp</th><th>&nbsp</th></tr>
</thead>
</table>

10000
1066fdg
10
 

我需要此列宽来设置车身td的列宽。我在这里贴了一个问题。明亮的有时,您需要固定宽度的表,以任何方式在一个纯粹的CSS方式做这件事?我在一个网站中有数百个页面需要此更新,但我希望不必到处查看添加
标签
<table style='table-layout:fixed' border="1" >
<col width="5%" />
<col width="95%" />
<thead>
<tr>
<th colspan='2'>10000</th>
</tr>

<tr>
<th>1066fdg</th>
<th>10</th>
</tr>
    <tr><th>&nbsp</th><th>&nbsp</th></tr>
</thead>
</table>