谢谢阅读。
我有这个 html 片段
<div class="table">
<!--1st row --->
<div class="cell_short table_cell">1</div>
<div class="cell_medium table_cell">Nickname</div>
<div class="cell_short table_cell">-</div>
<div class="clear"></div>
<!--2nd row --->
<div class="cell_short table_cell">2</div>
<div class="cell_medium table_cell">Nickname</div>
<div class="cell_short table_cell">-</div>
<div class="clear"></div>
<!--3rd row --->
<div class="cell_short table_cell">3</div>
<div class="cell_medium table_cell">Nickname</div>
<div class="cell_short table_cell">-</div>
<div class="clear"></div>
<!--4th row --->
<div class="cell_short table_cell">4</div>
<div class="cell_medium table_cell">Nickname</div>
<div class="cell_short table_cell">-</div>
<div class="clear"></div>
<!--5th row --->
<div class="cell_short table_cell">5</div>
<div class="cell_medium table_cell">Nickname</div>
<div class="cell_short table_cell">-</div>
<div class="clear"></div>
<!--6th row --->
<div class="cell_short table_cell">6</div>
<div class="cell_medium table_cell">Nickname</div>
<div class="cell_short table_cell">-</div>
<div class="clear"></div>
<!--7th row --->
<div class="cell_short table_cell">7</div>
<div class="cell_medium table_cell">Nickname</div>
<div class="cell_short table_cell">-</div>
<div class="clear"></div>
<!--8th row --->
<div class="cell_short table_cell">8</div>
<div class="cell_medium table_cell">Nickname</div>
<div class="cell_short table_cell">-</div>
<div class="clear"></div>
</div>
还有这种风格
.table {
border-spacing: 2px 1px;
background-color: black;
width: 316px;
}
.table_cell {
height: 30px;
line-height: 30px;
position: relative;
display: table-cell;
background-color: red;
}
.cell_short {
width: 80px;
text-align: center;
}
.cell_medium {
width: 150px;
text-align: center;
}
如您所见,我有一个有几行的表。一行的每个单元格都有边框间距:2px 1px。当我尝试使用 jquery 从 DOM 中删除一行时,会删除整行但保持边框间距:2px 1px。如果我删除几行边框间距:2px 1px 累积并留下大空间。我不知道这是否微不足道,但我找不到任何相关的东西。
谁能启发我为什么会这样?