是否可以删除所选行/单元格之间的边框间距?我想删除"内容"单元格之间的间距并将其显示为一行。我尝试为所选行添加border-spacing
,但似乎不起作用
下面是我的代码
<html>
<head>
<style>
.flex_container {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
.inner {
height:1000px;
width: 900px;
background-color:#000;
background-size: cover;
color: white;
display: flex;
/* justify-content: center;
align-items: center;
*/
}
.table-border {
border-collapse: separate;
border-spacing: 6px 5px;
table-layout: fixed;
color: white;
font-size: 15px;
display: inline-block;
}
.table-border tr th {
background-color: rgb(255,255,255,0.6);
border-radius: 2px;
padding-right: 35px;
padding-left: 35px;
padding-top: 10px;
padding-bottom: 10px;
}
.content-inner {
margin-top: 250px;
margin-left: 50px;
}
</style>
</head>
<body>
<div class="flex_container">
<div class="inner">
<div class="content-inner">
<table class="table-border">
<tbody>
<tr>
<th>heading 1</th>
<th>heading 2</th>
<th>heading 3</th>
<th>heading 4</th>
</tr>
<tr style="background:rgba(255, 255, 255, 0.3)">
<td>content</td>
<td>content</td>
<td>content</td>
<td>content</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>
任何帮助都将不胜感激。谢谢
2条答案
按热度按时间fjnneemd1#
y1aodyip2#
border-collapse: collapse;
<th>
元素中使用<thead>
和<div>
您不一定需要
<table>
。您可以使用常规DIV、CSS flex或Grid以及aria-role="table"实现类似的功能