html中td边框显示,html – 如何在tr的背景颜色上显示td的边框

使用Firefox 24中的html表来显示信息,我广泛使用CSS来格式化行和列.

我遇到的问题是我为< td>指定了一些边框,为< tr>指定了背景颜色,但tr的背景颜色与td的边框重叠.

它是正常的,而t样式的顶部显示了tr样式吗?

这两个问题是:

>所有带有class =“ref”的td应该正确显示左右两个2px

.ann和.tbx行中的边框(设置tr背景颜色时不是这种情况)

>即使在相邻单元格中设置了背景颜色,也应始终显示第一列右边框,参见

div.tb tr td:first-child {

border-right: 1px solid black;

}

CSS:

/* Default reset style sheet */

* {

margin: 0;

padding: 0;

position: relative;

-webkit-box-sizing: border-box;

-moz-box-sizing: border-box;

box-sizing: border-box;

}

table {

border-collapse: collapse;

border-spacing: 0;

}

.tb {

font-family: Ubuntu;

font-size: small;

text-align: right;

}

div.tb tr td {

padding: 0 2px 0 2px;

}

div.tb tr td {

padding: 0 2px 0 2px;

}

div.tb tr td:not(:first-child) {

width: 92px;

}

div.tb tr td:first-child {

border-right: 1px solid black;

}

div.tb tr:not(:first-child) td:not(:first-child):not(.ref) {

border-right: 1px solid #b0b0b0;

}

div.tb tr td.ref { /* FIXME */

border-left: 2px solid black;

border-right: 2px solid black;

}

div.tb tr.ann {

background: #99CCFF;

font-size: 1.3em;

font-weight: bold;

text-align: center;

border-bottom: 1px solid black;

}

div.tb tr.ann td {

height: 2.5em;

}

div.tb tr.ann td:first-child {

background: white;

font-size: small;

font-weight: bold;

text-align: right;

}

div.tb tr.ann td.ref {

background: green;

color: white;

}

div.tb tr.txb {

background: #99CCFF;

font-weight: bold;

}

HTML:

BarfooBarBlahFoobarFooBlahBlahBarFoo
ann1391312915
nbr-3420151812312
txb2,83%3,38%3,84%3,21%3,52%3,27%

如果可能的话,我想保持设置border-collapse:collapse(而不是单独),如下所示:

table {

border-collapse: collapse;

border-spacing: 0;

}

我不喜欢Table Border Overlap解决方案,因为div增加了额外的边框宽度并使代码不易清晰.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值