【发布时间】:2015-02-09 01:42:31
【问题描述】:
这是想要的效果:
这就是我想出的:http://jsfiddle.net/nunoarruda/3j6782js/
// table
.sw-table {
border-collapse: separate;
thead {
background-color: $orange;
color: $white;
font-size: 15px;
th {
border: none !important;
font-weight: 600;
padding-top: 5px !important;
padding-bottom: 5px !important;
margin: 30px 27px !important;
&:first-child {
border-top-left-radius: 10px;
padding-left: 25px;
}
&:last-child {
border-top-right-radius: 10px;
}
}
}
tbody {
color: $black;
tr {
td {
border-color: $greyish;
padding-top: 10px !important;
padding-bottom: 10px !important;
}
td:first-child {
border-left: 1px solid $greyish;
padding-left: 25px;
}
td:last-child {
border-right: 1px solid $greyish;
}
&:first-child td {
border-top: none;
}
&:last-child td {
border-bottom: 1px solid $greyish;
&:first-child {
border-bottom-left-radius: 10px;
}
&:last-child {
border-bottom-right-radius: 10px;
}
}
}
}
}
只是缺少表格行和表格边框之间的空间。我尝试过使用边距、填充、边框、边框折叠,但我无法达到预期的效果。有什么想法吗?
【问题讨论】:
-
样式化表格,尤其是表格行的样式是出了名的难。因此,我认为您最终将不得不使用一个有点“肮脏”的解决方案,例如添加额外的列或在每个表格单元格中插入一个 DIV。
-
我不认为你可以设置边框的宽度......内容需要嵌套在 td 内部的某些东西中并对其应用边框。或者按照@wlin 的建议添加额外的 td。您可以添加一个额外的行,其行跨度仅包含一个带有边框的 div 左右边距。
-
@chipChocolate.py 这不是我们想要的视觉效果...
-
@chipChocolate.py 我认为你没有抓住重点。检查屏幕截图。我需要表格行和表格边框之间的间距,而不是相反。但是感谢您的努力!
-
天啊!对不起!我的错,现在我知道你想要什么了。