问题描述
当两个<$ c $ tbody 标记都这样显示时,是否可以消除两个 tbody
标记之间的轻微间隙?
Is there a way to eliminate the slight gap between two tbody
tags when they are both displayed inline like this?
正如您在小提琴中看到的那样,在两个表之间有一个微小的差距。我知道我可以使用负边距手动消除此问题,但这似乎很麻烦,因为我有一个表,该表的变量数为 tbody
s。
As you can see in the fiddle, in between the two tables there is a slight gap. I know I can get rid of this manually by using negative margin, but this seems like a hassle since I have a table with a variable number of tbody
s.
<table style="margin:0;" border="1">
<tbody style="display: inline-block; margin:0;">
<tr>
<td>
1
</td>
<td>
2
</td>
</tr>
<tr>
<td>
3
</td>
<td>
4
</td>
</tr>
</tbody>
<tbody style="display: inline-block; margin: 0;">
<tr>
<td>
1
</td>
<td>
2
</td>
</tr>
<tr>
<td>
3
</td>
<td>
4
</td>
</tr>
</tbody>
</table>
推荐答案
就像添加 border-间距:0;
到您的表
元素将有所帮助。没有这个,每个边框周围有2个像素,这意味着表格之间有4个像素。
Looks like adding border-spacing: 0;
to your table
elements will help. Without this, there's 2 pixels surrounding each of the borders, which means there's 4 pixels between the tables.
这篇关于消除肢体标签之间的间隙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!