有一些类似的问题,但迄今为止我没有找到令人满意的答案。我有一个响应式表格,就像示例中的表格(实际上是WordPress管理员界面)。
HTML 只能被改变到一定程度 -- 我必须使用表格。我想让一个单元格具有像素和百分比的最小宽度。
就像这样:
.input-cell {
min-width:40%;
min-width:200px;
}
只有第二个属性会起作用,因此这并没有帮助。更糟糕的是,无论我使用 table-layout:fixed
还是 table-layout:auto;
,min-width
都无法与表格单元格一起使用。
以下示例演示了具有普通 width
样式的表格。
table {
width:100%;
table-layout:auto;
}
.input-cell {
width:40%;
}
textarea, input {
width:95%;
}
<table>
<thead>
<tr valign="top">
<th scope="row">Setting</th>
<th scope="row">Value</th>
<th scope="row">Beschreibung</th>
<th scope="row">ID</th>
</tr>
</thead>
<tbody>
<tr valign="top">
<td valign="top">Post Widget: Output callbacks</td>
<td valign="top" class="input-cell">
<textarea id="foo" name="bar" rows="7">Lorem ipsum ...</textarea>
</td>
<td class="description" valign="top">Lorem ipsum dolor sit amet.</td>
<td class="cis_field_id" valign="top">master_cum_esse_sunc_veniat</td>
</tr>
<tr valign="top">
<td valign="top">Post Widget: Output callbacks</td>
<td valign="top" class="input-cell">
<input type="text" name="lorem" id="aliquot" value="abc" />
</td>
<td class="description" valign="top">Lorem ipsum dolor sit amet.</td>
<td class="cis_field_id" valign="top">master_cum_esse_sunc_veniat</td>
</tr>
</tbody>
</table>
min-width
中哪个更具优先级? - Asonsmin-width: 40%
时,40% 是指什么? - Asons