【问题标题】:Set width of table - not afftected设置表格宽度 - 不受影响
【发布时间】:2016-09-29 03:37:09
【问题描述】:

我正在尝试使用类选择器为某个表设置固定宽度。 但它根本不受影响。这种语法有什么遗漏/错误?

css

.delivoptions_table th {
  table-layout:fixed;
  overflow: hidden;
  width: 200px;
}

表格..

<div class = "delivoptions_table">
    <table id="deliver_alt_table">

            <tr>
                <td> ... </td>
            </tr>

         ...

    </table>
 </div>

【问题讨论】:

    标签: css class html-table


    【解决方案1】:

    您的 CSS 选择器定位到 .delivoptions_table &lt;div&gt; 中的所有 &lt;th&gt; 元素,但其中没有任何 &lt;th&gt; 元素。更新您的选择器以定位 &lt;table&gt; 本身:

    .delivoptions_table table {
        table-layout:fixed;
        overflow: hidden;
        width: 200px;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-18
      相关资源
      最近更新 更多