这是否可以通过CSS实现?
我在努力
tr.classname {
border-spacing: 5em;
}
但没有用。也许我做错了什么?
这是否可以通过CSS实现?
我在努力
tr.classname {
border-spacing: 5em;
}
但没有用。也许我做错了什么?
当前回答
表{边框折叠:单独;边框间距:0 1em;}
其他回答
tr {
display: block;
margin-bottom: 5px;
}
您有一个包含id相册的表,其中包含任何数据。。。我省略了trs和tds
<table id="albums" cellspacing="0">
</table>
在css中:
table#albums
{
border-collapse:separate;
border-spacing:0 5px;
}
.table {
border-collapse: separate;
border-spacing: 0 1rem;
}
这很适合我在表格之间提供垂直边距/间距。参考:https://www.w3docs.com/snippets/css/how-to-create-space-between-rows-in-the-table.html
您是否尝试过:
tr.classname { margin-bottom:5em; }
或者,也可以调整每个td:
td.classname { margin-bottom:5em; }
or
td.classname { padding-bottom:5em; }
我意识到这是对一个旧线程的回答,可能不是所要求的解决方案,但尽管所有建议的解决方案都没有达到我所需要的效果,但这个解决方案对我有效。
我有两个表格单元格,一个带有背景色,另一个带有边框色。上述解决方案删除了边界,因此右侧的单元格看起来像漂浮在半空中。成功的解决方案是用div和相应的类替换table、tr和td:table将是div id=“table_replacer”,tr将是div class=“tr_replaceer”,td将是div class=“td_replacer“(显然也将结束标记更改为div)
为了解决我的问题,css是:
#table_replacer{display:table;}
.tr_replacer {border: 1px solid #123456;margin-bottom: 5px;}/*DO NOT USE display:table-row! It will destroy the border and the margin*/
.td_replacer{display:table-cell;}
希望这对某人有所帮助。