css - 减少两个 td 元素之间的空间
问题描述
- 我有以下 html 代码,我在其中更改了 bdg6x 字段的位置。 如何减少通常由 bdg6x 占用的 bdg4x 和 bdg0x 之间的差距?
.comment {
font-size: 10px;
position: relative;
left: 100px;
top: -10px;
color: red;
}
<table class='badges'>
<tbody>
<tr class=info>
<td id='bdg41'>BADGE:</td>
<td id='bdg61' class='comment'>0002699965046</td>
<td id='bdg01'>000026999650:</td>
<td id='bdg21'>(n°1)</td>
</tr>
<tr class=info>
<td id='bdg42'>BIP:</td>
<td id='bdg62' class='comment'>0004328048703</td>
<td id='bdg02'>000043280487:</td>
<td id='bdg22'>(n°2)</td>
</tr>
</tbody>
</table>
解决方案
你必须摆脱第二个细胞。相反,把它放在第三个里面并使用绝对定位:
.comment {
position: relative;
}
.comment > span {
display: inline-block;
font-size: 10px;
color: red;
position: absolute;
top: -6px;
right: 5px;
}
<table class='badges'>
<tbody>
<tr class=info>
<td id='bdg41'>BADGE:</td>
<td id='bdg01' class='comment'><span>0002699965046</span>000026999650:</td>
<td id='bdg21'>(n°1)</td>
</tr>
<tr class=info>
<td id='bdg42'>BIP:</td>
<td id='bdg02' class='comment'><span>0004328048703</span>000043280487:</td>
<td id='bdg22'>(n°2)</td>
</tr>
</tbody>
</table>
推荐阅读
- python - AttributeError:“MinMaxScaler”对象没有属性“剪辑”
- django - 如何在 Django 中显示不同时区的所有日期时间对象
- c - _Generic 适用于 typedef 结构还是仅适用于原始类型?
- c++ - 当我在 C++20 中使用范围时,为什么管道运算符不起作用?
- python - Python 3.8.2 - 尝试在本地网络中查找chromecast-PyChromecast
- html - 避免在电话区使用 ´ 或 ` 字符
- python - Python 虚拟环境使用与安装不同的模块
- php - 如何在结帐期间获取用户角色并将其存储为用户元?
- ada - 如何保存判别记录的访问类型以供以后使用
- express - 我们如何在使用 express 的自定义服务器中使用 buefy 配置 nuxtjs