4

tr別のクラス名を持つテーブルの最初の行に CSS でアクセスする方法。

<div id="right">
 <table>
 <tbody>
 <tr class="head">
 <td >Date</td><td>Info</td><td>More</td>
 </tr>
<tr><td>...</td></tr></table>
</div>

このcssの作り方

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

.head のみに適用する

4

4 に答える 4

3
#right .head td:first-child{
    border-top-left-radius: 10px; 
}
#right .head td:last-child {
    border-top-right-radius: 10px;
}
于 2013-09-17T12:38:32.100 に答える
0

疑似クラス:first-childを使用して最初の要素を取得します。

お気に入り:

#right .head td:first-child {
    border-top-left-radius: 10px; 
}
#right .head td:last-child {
    border-top-right-radius: 10px;
}
于 2013-09-17T12:36:56.503 に答える