Html 建议采用哪种方式设置表列的宽度?

Html 建议采用哪种方式设置表列的宽度?,html,Html,我曾经在这种情况下,我的意思是试图设置表列的宽度,我想知道哪一种是最好的方法 现在我正在使用这种方式,但大多数时候我只是猜测,将th width属性设置为1以向左拉动列 <table> <thead> <th width="1">Column1<th> <th width="1">Column2<th> <th>Column3<th> &

我曾经在这种情况下,我的意思是试图设置表列的宽度,我想知道哪一种是最好的方法

现在我正在使用这种方式,但大多数时候我只是猜测,将th width属性设置为1以向左拉动列

<table>
    <thead>
        <th width="1">Column1<th>
        <th width="1">Column2<th>
        <th>Column3<th>
    </thead>
    <tbody>
        <tr>
            <td>some content<td>
            <td>more content<td>
            <td>even more content<td>
        </tr>
    </tbody>
</table>

专栏1
专栏2
第3栏
一些内容
更多内容
更多内容

谢谢

为表分配一个ID/类。使用作为参照,指定表格单元格和表格标题样式。如果要将表格单元格左对齐,则无需保持宽度为1像素。可以为该单元格添加文本对齐属性

HTML:

<table id="MyCustomTable">
<thead>
    <th>Column1<th>
    <th>Column2<th>
    <th>Column3<th>
    <th>Column4<th>
</thead>
<tbody>
    <tr>
        <td>some content<td>
        <td>more content<td>
        <td>even more content<td>
        <td>even more content new<td>
    </tr>
</tbody>
</table>
#MyCustomTable
{
 width:100%;
 border-collapse:collapse;
 padding:0;
 border:0;
}
 #MyCustomTable th
{
 text-align:center;
 width:25%; 
 background-color:#d8d8d8;
 font-weight:700;
 }
#MyCustomTable td
{
 text-align:left;
 width:25%; 
}

使用css
table thead{width:10px;}