Reputation: 107
How to access with CSS first row of the table with different tr
class name.
<div id="right">
<table>
<tbody>
<tr class="head">
<td >Date</td><td>Info</td><td>More</td>
</tr>
<tr><td>...</td></tr></table>
</div>
How to make this 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;
}
to apply only to .head
Upvotes: 4
Views: 15569
Reputation: 3662
#right table tr.head td:first-child {
border-top-left-radius: 10px;
}
#right table tr.head td:last-child {
border-top-right-radius: 10px;
}
Upvotes: 0
Reputation: 2014
You can take it further by doing.
#right tr:first-child td:first-child {
background-color: red;
}
Selecting the first tr and then the first td.
Upvotes: 1
Reputation: 1652
#right .head td:first-child{
border-top-left-radius: 10px;
}
#right .head td:last-child {
border-top-right-radius: 10px;
}
Upvotes: 4
Reputation: 1359
use pseudo class :first-child
to get the first element.
Like:
#right .head td:first-child {
border-top-left-radius: 10px;
}
#right .head td:last-child {
border-top-right-radius: 10px;
}
Upvotes: 0