html - HTML 和 CSS 中带有底线的图书索引布局样式

标签 html css layout html-table

如何在 HTML 和 CSS 中实现此布局? example

也许有一个表格,但我需要中心列来用边框底部(或其他东西)填充空白

这是一个codepen

<table class="table">
  <tbody>
    <tr>
      <td>
        <h5>Index 1</h5></td>
      <td>
        <span class="line">&nbsp;</span>
      </td>
      <td>
        Content
      </td>
    </tr>
    <tr>
      <td>
        <h5>Index 2</h5></td>
      <td>
        <span class="line"></span>
      </td>
      <td>
        Content
      </td>
    </tr>
  </tbody>
</table>

最佳答案

试试这个

<table class="table">
  <tbody>
    <tr>
      <td class="Index">
        <h5>Index 1</h5>
      </td>

      <td>
        Content
      </td>
    </tr>
    <tr>
      <td class="Index">
        <h5>Index 11</h5>
      </td>

      <td>
        Content
      </td>
    </tr>
  </tbody>
</table>

<----CSS----->

table {
  width: 50%;
  border-collapse: collapse;
  white-space: nowrap;
}
table h5 {
  margin: 0;
  display:inline-block;
}
td,
tr,
table {
  padding: 0;
  overflow:hidden
}

.Index::after{
  content:"";
width:100%;
  display:inline-block;
background-color:#000;
height:1px;}

关于html - HTML 和 CSS 中带有底线的图书索引布局样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40485700/

相关文章:

javascript - 读取文本文件以在 HTML 中显示

html - 我如何在 CSS 中执行 "min-height: height of content; height: relative to viewport;"?

javascript - 单击时输入将关闭列表,但不应

html - 粘性页脚问题

html - 如何使用html div标签和css进行水平分割

android - 我应该在 Android 4.4 的 CSS 中使用什么中文字体?

html - 为什么我们不能使用 CSS 在 HTML 中自定义样式选择选项的突出显示颜色?

html css 菜单可见性按权限隐藏

android - 通过 URL 更改 Framelayout 的背景图像

java - 如何让 FlowLayout 像其他组件一样在底部对齐 JPanel?