首页 > 解决方案 > 带有自动调整大小的尾随下划线的表头 CSS

问题描述

仅使用 HTML 和 CSS,我希望有一个如下表:

  Header1          Header2
  --------------   --------------------
  L1Col1 content   L1Col2 wider content
  L2Col1 datum     L2Col2 datum2

Where the underline automatically sizes to the
table column width.

Help!  

标签: css

解决方案


阿祖,谢谢你的回答。“边框间距”的用法对我来说完全有启发性。我将 CSS 修改为以下内容:

.sample-table {
    text-align: left;
    border-spacing: 25px 0;
}
.sample-table th {
    border-bottom: 2px solid #000;
}
.sample-table td,
.sample-table th {
    padding: 3px 0px;
}   

这正是我想要的。


推荐阅读