4 回答

TA貢獻1796條經驗 獲得超10個贊
當您可能有一些空的 colspan 時,Chrome 或 Opera 可能會發生此錯誤。所以要么你直接選擇沒有不透明度的灰色,因為它來自不透明度。
要么你使用下面的技巧和 box-shadow。
tr {
box-shadow: 0px 1px 0px 0px rgba(38, 46, 46, 0.2);
}
tr:first-child我還為和自定義屬性tr:last-child。保持邊框正常而不使用框陰影
演示:
.table-content {
overflow-x: auto;
}
.table-content table tr th {
font-weight: 500;
}
table {
border-collapse: collapse;
width: 100%;
}
tr:first-child, tr:last-child{
box-shadow: 0px 0px 0px 0px rgba(38, 46, 46, 0.2);
border-bottom: 1px solid rgba(38, 46, 46, 0.2);
}
tr {
box-shadow: 0px 1px 0px 0px rgba(38, 46, 46, 0.2);
}
th {
background: rgb(0 0 0 / 15%);
padding: 15px;
border-bottom: 1px solid rgba(38, 46, 46, 0.2);
color: $dark-text;
font-size: 0.875rem;
font-weight: 600;
text-align: left;
text-transform: uppercase;
white-space: nowrap;
}
td {
padding: 15px;
font-size: 1rem;
}
<div class="table-content">
<table>
<tr>
<th rowspan="1"></th>
<th>Product</th>
<th>Rate</th>
<th>Discount</th>
<th>Quantity</th>
<th rowspan="1"></th>
<th>Amount</th>
</tr>
<tr>
<td>
<span>
<img src="/assets/images/img-placeholder.svg" >
</span>
</td>
<td>keychain</td>
<td>200</td>
<td>20</td>
<td>Ordered</td>
<td>10</td>
<td>20</td>
</tr>
<tr>
<td colspan="4"></td>
<td>Invoiced</td>
<td>2</td>
<td colspan="1"></td>
</tr>
<tr>
<td colspan="4"></td>
<td>Shipped</td>
<td>1</td>
<td colspan="1"></td>
</tr>
<tr>
<td colspan="4"></td>
<td>Returned</td>
<td>1</td>
<td colspan="1"></td>
</tr>
</table>
</div>

TA貢獻1876條經驗 獲得超5個贊
我沒有看到 CSS 有什么問題,但如果你填寫整個表格,它應該會消失。
.table-content {
overflow-x: auto;
}
.table-content table tr th {
font-weight: 500;
}
table {
border-collapse: collapse;
width: 100%;
}
tr {
border-bottom: 1px solid rgba(38, 46, 46, 0.2);
}
th {
background: rgb(0 0 0 / 15%);
padding: 15px;
border-bottom: 1px solid rgba(38, 46, 46, 0.2);
color: $dark-text;
font-size: 0.875rem;
font-weight: 600;
text-align: left;
text-transform: uppercase;
white-space: nowrap;
}
td {
padding: 15px;
font-size: 1rem;
}
<div class="table-content">
<table>
<tr>
<th rowspan="1"></th>
<th>Product</th>
<th>Rate</th>
<th>Discount</th>
<th>Quantity</th>
<th rowspan="1"></th>
<th>Amount</th>
</tr>
<tr>
<td>
<img src="/assets/images/img-placeholder.svg" >
</td>
<td>keychain</td>
<td>200</td>
<td>20</td>
<td>Ordered</td>
<td>10</td>
<td>20</td>
</tr>
<tr>
<td>
<img src="/assets/images/img-placeholder.svg" >
</td>
<td>keychain</td>
<td>200</td>
<td>20</td>
<td>Ordered</td>
<td>10</td>
<td>20</td>
</tr>
<tr>
<td>
<img src="/assets/images/img-placeholder.svg" >
</td>
<td>keychain</td>
<td>200</td>
<td>20</td>
<td>Ordered</td>
<td>10</td>
<td>20</td>
</tr>
<tr>
<td>
<img src="/assets/images/img-placeholder.svg" >
</td>
<td>keychain</td>
<td>200</td>
<td>20</td>
<td>Ordered</td>
<td>10</td>
<td>20</td>
</tr>
</table>
</div>

TA貢獻1878條經驗 獲得超4個贊
.table-content {
overflow-x: auto;
}
.table-content table tr th {
font-weight: 500;
}
table {
border-collapse: collapse;
width: 100%;
}
tr {
}
th {
background: rgb(0 0 0 / 15%);
padding: 15px;
border-bottom: 1px solid rgba(38, 46, 46, 0.2);
color: $dark-text;
font-size: 0.875rem;
font-weight: 600;
text-align: left;
text-transform: uppercase;
white-space: nowrap;
}
td {
padding: 15px;
font-size: 1rem;
border-bottom: 1px solid #ddd;
}
<div class="table-content">
<table>
<tr>
<th rowspan="1"></th>
<th>Product</th>
<th>Rate</th>
<th>Discount</th>
<th>Quantity</th>
<th rowspan="1"></th>
<th>Amount</th>
</tr>
<tr>
<td>
<span>
<img src="/assets/images/img-placeholder.svg" >
</span>
</td>
<td>keychain</td>
<td>200</td>
<td>20</td>
<td>Ordered</td>
<td>10</td>
<td>20</td>
</tr>
<tr>
<td colspan="4"></td>
<td>Invoiced</td>
<td>2</td>
<td colspan="1"></td>
</tr>
<tr>
<td colspan="4"></td>
<td>Shipped</td>
<td>1</td>
<td colspan="1"></td>
</tr>
<tr>
<td colspan="4"></td>
<td>Returned</td>
<td>1</td>
<td colspan="1"></td>
</tr>
</table>
</div>
我解決了問題...我認為顏色代碼是錯誤的。
添加回答
舉報