我找到了一個CSS教程來設置表格的樣式,但在我的頁面上還有其他表格。所以我無法弄清楚如何在這裏使用選擇器。 tr:nth-of-type(odd)
是選擇器。但我希望這隻能用於名爲playerslist
的表id
或class
。類特定類型(單數)
<table id="playerslist">
<thead>
<tr>
<th>Player Name</th>
<th>Player #</th>
<th>Team</th>
</tr>
</thead>
<tbody>
<tr>
<td>Simon</td>
<td>25</td>
<td>Team A</td>
</tr>
<tr>
<td>Richard</td>
<td>5</td>
<td>Team B</td>
</tr>
</tbody>
</table>
任何想法如何定位與playerslist
的id
表的tr:nth-of-type(odd)
,th
和td
元素?
謝謝
謝謝你,好主意:) – cevizmx
我不認爲這是想法,如果你發現了一分鐘,有點了解[CSS選擇器]這是很基本的:)( http://www.w3schools.com/cssref/css_selectors.asp)。 –