Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.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 - Fatal编程技术网

Html表格固定列宽

Html表格固定列宽,html,Html,我有一个html表格,有两列两行。我想让柱子保持固定。那么比如说, 行1文本下拉列表 Row2Text文本框 相反,正在发生的是下降趋势正在转变。比如说, 行1文本下拉列表 Row2Text文本框 这发生在IE 11和Chrome版本35.0.1916.153中。然而,它在IE9中运行良好 以下是我正在使用的代码: .Text{ 宽度:600px; } 函数下拉更改(值){ 如果(值=“2”){ document.getElementById(“Row2”).style.display=“blo

我有一个html表格,有两列两行。我想让柱子保持固定。那么比如说,

行1文本下拉列表
Row2Text文本框

相反,正在发生的是下降趋势正在转变。比如说,

行1文本下拉列表
Row2Text文本框

这发生在IE 11和Chrome版本35.0.1916.153中。然而,它在IE9中运行良好

以下是我正在使用的代码:

.Text{
宽度:600px;
}
函数下拉更改(值){
如果(值=“2”){
document.getElementById(“Row2”).style.display=“block”;
}
否则{
document.getElementById(“Row2”).style.display=“无”;
}
}
第1行:
1.
2.
第2行:

更改html结构,如下所示:

html

<table style="width:100%;">
    <tr>
        <th align="left" style="width: 15%">
            Row1:
            <select onchange="DropdownChange(this.value)">
                <option value="1">1</option>
                <option value="2">2</option>
            </select>
        </th>
        <td style="width: 85%"></td>
    </tr>
    <tr id="Row2" style="display:none;">
        <th align="left" style="width: 15%">
            Row2:
        </th>
        <td style="width: 85%">
            <input type="text" class="Text"/>
        </td>
    </tr>
</table>

第1行:
1.
2.
第2行:
您必须在


我需要使用“显示:表格行”而不是“显示:块”。这个问题的答案如下:

这是我想要的。但是,我不明白为什么我的代码中的列宽不是固定的。我显式地将这两行的标题列的宽度设置为15%,因为您将文本宽度设置为600px。
<table style="width:100%;">
    <tr>
        <th align="left" style="width: 15%">
            Row1:
            <select onchange="DropdownChange(this.value)">
                <option value="1">1</option>
                <option value="2">2</option>
            </select>
        </th>
        <td style="width: 85%"></td>
    </tr>
    <tr id="Row2" style="display:none;">
        <th align="left" style="width: 15%">
            Row2:
        </th>
        <td style="width: 85%">
            <input type="text" class="Text"/>
        </td>
    </tr>
</table>