css - 为什么TR不采取风格?

标签 css xhtml

CSS

table tr {border-bottom:1px solid #008999}

HTML

<table width="100%" cellspacing="0" cellpadding="0">
   <thead>
      <tr>
         <th scope="col">one</th>
         <th scope="col">two</th>
         <th scope="col">three</th>
      </tr>
   </thead>
   <tbody>
      <tr>
         <th scope="row">Hello</th>
         <td>&nbsp;</td>
         <td>&nbsp;</td>
      </tr>
   </tbody>
</table>

最佳答案

添加:

table
{
    border-collapse: collapse;
}

否则 tr creates no single block .

简单的例子:

table
{
  border: 5px solid #900;
  background: #fff;
}
tr
{
  border: 5px solid #090;
}
td
{
  background: #ccc;
  padding: 5px 0;
}

table + table
{
  border-collapse: collapse;
}
<table>
  <tr>
    <td>def</td>
    <td>ault</td>
  </tr>
</table>
<table>
  <tr>
    <td>coll</td>
    <td>apse</td>
  </tr>
</table>

关于css - 为什么TR不采取风格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2597694/

相关文章:

通过 HTML 元素加载 Javascript 幻灯片图像

javascript - 自定义 Angular 指令、控制台日志、DOM 更新、屏幕不

html - 如何使用数据表删除上一个/下一个链接上的悬停样式

html - css/html 响应式和视口(viewport)缩放问题

javascript - 基于 html 的代码编辑器

jquery - 悬停/选定的菜单显示背景

html - 我可以使用什么标记将信息存储在 XHTML 文档 HEAD 中,而浏览器会忽略它?

iPhone移动网络+删除Safari界面栏

css - <img> 的 html5 垂直间距问题

css - 与 Firefox 和 Chrome 相比,IE 中的 Div 高度不同