我正在使用多个具有不同属性的表。问题是我所有的表似乎都是从一个类“spectable”中获取它们的属性。特别是边框,我不想要任何其他类的边框。如何正确分配多个表?
HTML
/*I only need a table here to keep it centered in the page, so i want no border*/
<table class="bantable">
<tr>
<td align="middle">
<div id="container">
<!-- Each image is 350px by 233px -->
<div class="photobanner">
<img class="first" src="/banner/AA.JPG" alt="">
<a target="_blank" href="P1010011.JPG">
</div>
</div>
</td>
</tr>
</table>
/*this one i want the border in*/
<table class="spectable">
<tr>
<th>Type</th>
<td>GMC 7000 Dump Truck</td>
<tr>
<th>Stock#</th>
<td>70017</td>
<th>Condition</th>
<td>N/A</td>
</tr>
<tr>
</table>
CSS
table.bantable table, td, th, tr
{
border: none;
}
table.spectable table, td, th
{
border: 3px solid #fdff30;
}
table.spectable th
{
background-color: #fdff30;
color: black;
}
最佳答案
您使用 td, th, 表格选择器的方式是错误的。像下面这样更新您的 CSS。
table.bantable, table.bantable td, table.bantable th, table.bantable tr
{
border: none;
}
table.spectable, table.spectable td, table.spectable th
{
border: 3px solid #fdff30;
}
table.spectable th
{
background-color: #fdff30;
color: black;
}
关于html - 无法将多个类分配给表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24537237/