2016-04-26 24 views

回答

0

是這樣的嗎?

tr:last-child { 
    border-bottom-right-radius: 15px; 
} 
4

是這樣的東西你想要什麼?

tr:last-child td:first-child { 
    border-bottom-left-radius: 15px; 
} 
tr:last-child td:last-child { 
    border-bottom-right-radius: 15px; 
} 
+0

你就近了。這裏的問題是所有'中間'行仍然會收到樣式。 –

+1

@Michael_B的答案爲你運行,它看起來像它的工作 – jpopesculian

1

th,td { 
 
    width: 100px; 
 
    height: 100px; 
 
    border: 1px solid red; 
 
} 
 
th:first-child { 
 
    border-top-left-radius: 15px; 
 
} 
 
th:last-child { 
 
    border-top-right-radius: 15px; 
 
} 
 
tr:last-child td:first-child { 
 
    border-bottom-left-radius: 15px; 
 
} 
 
tr:last-child td:last-child { 
 
    border-bottom-right-radius: 15px; 
 
}
<table> 
 
    <tr> 
 
    <th></th> 
 
    <th></th> 
 
    <th></th> 
 
    <th></th> 
 
    </tr> 
 
    <tr> 
 
    <td></td> 
 
    <td></td> 
 
    <td></td> 
 
    <td></td> 
 
    </tr> 
 
    <tr> 
 
    <td></td> 
 
    <td></td> 
 
    <td></td> 
 
    <td></td> 
 
    </tr> 
 
</table>

+0

非常好。有了像你這樣的代碼,我的頁面仍然保留每個中間行的樣式。你認爲我的問題是AngularJS和CSS選擇器之間的問題嗎? –

+0

打開瀏覽器檢查器,看看哪些樣式正在應用到您的中間行。你也可以看到這些風格的來源。 –

+0

啊是的。中間元素有tr:最後孩子td:第一個孩子造型。 –

0

讓我們假設你有與fooid一個table

#foo tr:last td:first-child { 
    border-top-left-radius: 15px; 
} 
#foo tr:last td:last-child { 
    border-top-right-radius: 15px; 
} 

請確保您在表格末尾沒有隱形tr s。