我有以下 CSS 代码:
tr.uprightTr
{
padding: 0px;
margin: 0px;
height: 10px;
border: none;
border-spacing: 0px;
}
td.uprightTd
{
padding: 0px;
margin: 0px;
height: 10px;
border: none;
border-spacing: 0px;
}
table.uprightTbl
{
padding: 0px;
margin: 0px;
border: none;
border-collapse: collapse;
border-spacing: 0px;
}
以及以下 HTML:
<table class="uprightTbl" cellpadding="0" cellspacing="0">
<tr class="uprightTr">
<td class="uprightTd"><input type="checkbox" /></td>
...
无论我尝试什么,它都会在元素之间保留一些空间。关于我可以尝试什么或可能做错了什么有什么想法吗?
P.S: 我也在 Chrome 上检查了元素,元素成功到达相关的 css 行。
最佳答案
您是否尝试为所有元素添加 CSS 规则,例如:
.uprightTbl * {
border: none;
border-collapse: collapse;
padding: 0;
margin: 0;
}
它可能会解决您的问题。
关于没有空格的 HTML 表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13709632/