gpt4 book ai didi

html - 隐藏表格特定行的边框,HTML CSS

转载 作者:太空宇宙 更新时间:2023-11-04 07:52:38 25 4
gpt4 key购买 nike

我正在尝试去掉此表中特定行的边框。我想要在 Men 和 Armada 品牌的行周围有一个边框,但不要有中间的 botder 线。出于某种原因,我无法使用 tr 类摆脱它。我犯了什么错误?

table,
tr,
td,
th {
border: 1px solid;
border-collapse: collapse;
}

.noBorder {
border: 0;
}
<table>
<tr class="noBorder">
<th>Men</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<th>Brand</th>
<th>Model</th>
<th>Waist</th>
<th>Lengths</th>
<th>Quick Description </th>
</tr>
<tr class="noBorder">
<th>Armada</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<td>Armada</td>
<td>Tracer 88</td>
<td>88</td>
<td>162, 172</td>
<td>Cut with an 88mm waist width and Armada s snow-shedding Tapertop topsheet to minimize added weight from snow buildup, the Armada Tracer 88 Skis travel swiftly and efficiently uphill while the EST All-Mtn Rocker provides versatile performance on the
journey down.</td>
</tr>

最佳答案

您正在将边框应用于 trth/td。因此,从 tr 中删除边框是不够的。您还需要将其从 th/td 中删除,以便您可以像这样调整您的 CSS:

table,
tr,
td,
th {
border: 1px solid;
border-collapse: collapse;
}

.noBorder {
border: 0;
}

.noBorder th,
.noBorder td {
border: 0;
}
<table>
<tr class="noBorder">
<th>Men</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<th>Brand</th>
<th>Model</th>
<th>Waist</th>
<th>Lengths</th>
<th>Quick Description </th>
</tr>
<tr class="noBorder">
<th>Armada</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<td>Armada</td>
<td>Tracer 88</td>
<td>88</td>
<td>162, 172</td>
<td>Cut with an 88mm waist width and Armada s snow-shedding Tapertop topsheet to minimize added weight from snow buildup, the Armada Tracer 88 Skis travel swiftly and efficiently uphill while the EST All-Mtn Rocker provides versatile performance on the
journey down.</td>
</tr>

另一个解决方案是使用 colspan 来避免添加空单元格:

table,
tr,
td,
th {
border: 1px solid;
border-collapse: collapse;
}

.noBorder {
border: 0;
}
<table>
<tr class="noBorder">
<th colspan=5>Men</th>
</tr>
<tr>
<th>Brand</th>
<th>Model</th>
<th>Waist</th>
<th>Lengths</th>
<th>Quick Description </th>
</tr>
<tr class="noBorder">
<th colspan=5>Armada</th>
</tr>
<tr>
<td>Armada</td>
<td>Tracer 88</td>
<td>88</td>
<td>162, 172</td>
<td>Cut with an 88mm waist width and Armada s snow-shedding Tapertop topsheet to minimize added weight from snow buildup, the Armada Tracer 88 Skis travel swiftly and efficiently uphill while the EST All-Mtn Rocker provides versatile performance on the
journey down.</td>
</tr>

关于html - 隐藏表格特定行的边框,HTML CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47612747/

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