【问题标题】:Cannot override text-align left css无法覆盖文本左对齐 CSS
【发布时间】:2016-09-18 20:34:15
【问题描述】:

我有一张表,其中th 元素是text-align: left。在我的 CSS 中,我为我的 th 元素指定了 text-align: center,但由于某种原因它没有被覆盖。有谁知道为什么?我的桌子:

<table class="days_table" align="center">
  <thead>
    <tr>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th class="last_cell"></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td class="last_cell"></td>
    </tr>
  </tbody>
</table>

我的 CSS:

td, th {
    border-right: 1px solid gray;
    border-right-style: dotted;
    text-align: center;
}

这是我的小提琴供参考:

https://jsfiddle.net/qg8xzf2y/2/

【问题讨论】:

    标签: html css html-table alignment


    【解决方案1】:

    更具体,它将覆盖 tables.less 文件。在这种情况下:

    td, table th {
        border-right: 1px solid gray;
        border-right-style: dotted;
        text-align: center;
    }
    

    table th 特异性将战胜简单的th

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-12
      • 1970-01-01
      • 1970-01-01
      • 2020-01-03
      • 2015-02-12
      • 1970-01-01
      • 2012-04-09
      相关资源
      最近更新 更多