亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

行的 HTML CSS 表格邊框顏色問題

行的 HTML CSS 表格邊框顏色問題

拉風的咖菲貓 2023-04-20 17:11:48
.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>                            <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>            </table>        </div>有 border-bottom-color 我想使它與其他邊框相同,在這種情況下,表的第一行具有與其他 tr 相同的 border-bottom-color 屬性,但在第一行中,我添加了 td,例如圖片、價格、折扣所以問題是底部邊框顏色比其他 tr 邊框深一點。我怎樣才能獲得相同的邊框顏色..?
查看完整描述

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>


查看完整回答
反對 回復 2023-04-20
?
慕運維8079593

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>


查看完整回答
反對 回復 2023-04-20
?
UYOU

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>

我解決了問題...我認為顏色代碼是錯誤的。



查看完整回答
反對 回復 2023-04-20
?
拉丁的傳說

TA貢獻1789條經驗 獲得超8個贊

使用這樣的東西

tr{
    border-bottom: 1px solid silver;
}

為我工作。


查看完整回答
反對 回復 2023-04-20
  • 4 回答
  • 0 關注
  • 174 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號