css - 如何设置表格边框小于单元格高度

标签 css html html-table

我希望表格单元格之间的分隔线边框是它高度的一半

查看预览图:enter image description here

这是 fiddle 链接:

Fiddle link

#details_gdr {
    height: 50px;
    line-height: 25px !important;
    margin-top: 3px;
}

#details_gdr tbody tr:not(:last-child) {
    height: 25px;
    border-bottom: 1px solid #D0E0EA;
}

#details_gdr tbody tr th:not(:last-child) {
    border-right: 1px solid #D0E0EA;
}

#details_gdr tbody tr th {
    width: 28px;
    text-align: center !important;
}

最佳答案

这是您的解决方案。

#details_gdr {
    height: 50px;
    line-height: 25px !important;
    margin-top: 3px;
    border-collapse: collapse;
}

#details_gdr tbody tr:not(:last-child) {
    height: 25px;
    border-bottom: 1px solid #D0E0EA;
    font-size: 1.4em;
}

#details_gdr tbody tr:not(:last-child) th + th::before {
    color: #D0E0EA;
    content: '|';
    font-size: 0.6em;
    position: relative;
    top: -2px;
    left: -7px;
}

#details_gdr tbody tr th {
    width: 28px;
    text-align: center !important;
}

https://jsfiddle.net/p4ynsxt3/

关于css - 如何设置表格边框小于单元格高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34478694/

相关文章:

HTML 电子邮件 - 使图像适合表格单元格

css - Outlook 中的表格宽度过大

html - 在下拉菜单/可折叠菜单中相对定位菜单项?

javascript - 在 PhoneGap 应用程序中禁用文本选择器?

css - 如何在未知的多级<ul>中选择最后一个<li>

jquery mobile border-left 不为某些输入类型呈现

html - 将 td 一分为二

html - 如何CSS样式灵活的元素来匹配他们的 parent

javascript - onClientClick for asp :element within a listview

javascript - 如何在 JavaScript 函数中传递文件元素