gpt4 book ai didi

html - 如何在保持内容居中的同时将
添加到 的顶部?

转载 作者:太空宇宙 更新时间:2023-11-03 19:31:44 24 4
gpt4 key购买 nike

我试图在 <td> 中添加一条水平线标签实现:

This is what I want

但这就是我得到的:

This is what I get

这是一个 jsfiddle:http://jsfiddle.net/6qybn8w8/

请注意,我想要这个 <hr />标签只出现在 <td> 中的少数几个中而不是全部。另外,我无法删除 <td> 的填充因为我需要它来格式化其他 <td>s 的内容

最佳答案

你可以做这样的事情。

table {
border: 3px solid #0D94D2;
}
table th,
td {
padding: 4px 10px 4px 5px;
font-size: 12px;
}
table th {
background-color: #0D94D2;
text-align: center;
padding: 0.25em 0.25em;
white-space: nowrap;
}
table td {
width: auto;
text-align: center;
border-bottom: 1px solid #B1DCEA;
white-space: nowrap;
}
hr {
position: relative;
color: #0000FF;
background-color: #0000FF;
height: 0.75em;
width: 118.9%;
left: -6.5%;
}
<body>
<table>
<th>
Data
</th>
<tr>
<td>
<hr />
<div>
Some Gibber Gabber
</div>
</td>
</tr>
</table>
</body>

关于html - 如何在保持内容居中的同时将 <hr> 添加到 <td> 的顶部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27313166/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com