html - 对于 thead tr,边框未按预期工作

标签 html css

我希望 thead 中的整行都具有指定的边框,但是当我使用边框样式属性时它没有按预期工作。但它正在使用 outline 属性。这是一个代码片段:

table.table, table.table * {
			border: none !important;
		}

table.price-table thead tr {
			border: 10px solid blue;
			outline: thin solid red;

  
		}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<table class="table price-table">
  <thead>
    <tr>
      <th>Ticket Type</th>
      <th>Price</th>
    </tr>
  </thead>

  <tbody>
    <tr data-ticket-id=1>
      <td class="category-ticket">Adult</td>
      <td class="price-ticket">RM 20</td>
    </tr>



    <tr data-ticket-id=3>
      <td class="category-ticket">Child</td>
      <td class="price-ticket">RM 15</td>

    </tr>	



  </tr>																
</tbody>
</table>

最佳答案

使用 border: none !important; 覆盖您的第二个 border 声明。除非绝对必要,否则不推荐使用 !important。它使可维护性变得更加困难。更多信息see here .

关于html - 对于 thead tr,边框未按预期工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35837760/

相关文章:

html - 从 img 标签中删除边框

php - 根据从动态下拉框中选择的值预填充文本字段(在表单中)

jquery - Backbone Marionette 区域 + 布局 + View 层次结构和响应能力

javascript - 如何使用 jquery 将外部 html 代码插入到 Div

javascript - 使用$watch,表div消失

css - 外部和内部 Html 表 css 样式冲突

css - 为什么将逗号选择器放入空格选择器中会破坏父级选择器?

css 背景图像覆盖标题和文本

html - 通过 CSS 使输入不可见但可点击?

php - 从 PHP 文件提供的 Ogg 音频在 Chrome 上无法搜索