鍍金池/ 問答/HTML5  HTML/ css nth-child 如何讓第四個行不要有底線?

css nth-child 如何讓第四個行不要有底線?

.table_upgrade_works
{
  width: 100%;
  border-collapse: collapse;
}
.table_upgrade_works td {
  table-layout: fixed;
  word-break: break-all;
  border-bottom: 1px solid #ccc;
  font-size: 13px;
  text-align: center;
}
.table_upgrade_works td :nth-child(4){
  border-bottom: 1px solid #fff;
}

總共會有四個底線
但我想讓第四個底線不顯示
這樣寫沒辦法用

回答
編輯回答
默念

選擇第 4 列的單元格

.table_upgrade_works tr :nth-child(4) { }

選擇第 4 行的單元格

.table_upgrade_works tbody :nth-child(4) td { }

示例如下

<html>
    <head>
        <style type="text/css">
.table_upgrade_works
{
    width: 100%;
    border-collapse: collapse;
}
.table_upgrade_works td {
    table-layout: fixed;
    word-break: break-all;
    border-bottom: 1px solid #ccc;
    font-size: 13px;
    text-align: center;
}
.table_upgrade_works tbody :nth-child(4) td {
    border-bottom: 1px solid #fff;
}
        </style>
    </head>
    <body>
        <table class="table_upgrade_works">
            <thead>
                <tr>
                    <th>one</th>
                    <th>two</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>1</td>
                    <td>2</td>
                </tr>
                <tr>
                    <td>10</td>
                    <td>20</td>
                </tr>
                <tr>
                    <td>1</td>
                    <td>2</td>
                </tr>
                <tr>
                    <td>10</td>
                    <td>20</td>
                </tr>
                <tr>
                    <td>10</td>
                    <td>20</td>
                </tr>
            </tbody>
        </table>
    </body>
</html>

參考

https://www.w3schools.com/css...

2017年8月1日 07:48
編輯回答
瞄小懶
:nth-child(4n)
2017年6月9日 08:14