Reputation: 713
I have a table as below
<table className="TableClass">
<tbody>
<tr row="0">
<td>Data</td>
<td>Data</td>
</tr>
<tr row="1">
<td>Data</td>
<td>Data</td>
</tr>
</tbody>
</table>
I just need to add CSS to the <tr row="0">
only. will that be possible ?
Upvotes: 1
Views: 49
Reputation: 195
To apply styling on elements with certain attributes in CSS you can use the attribute selector. The syntax for attribute selector is
elementName [attribute = value]
So, you can just apply styling to the row 1 like this:
tr[row="0"]{
/*all styles here*/
}
Upvotes: 0
Reputation: 1021
You can use the [attribute=value] selector
tr[row="0"] {
background-color: yellow;
}
<table className="TableClass">
<tbody>
<tr row="0">
<td>Data</td>
<td>Data</td>
</tr>
<tr row="1">
<td>Data</td>
<td>Data</td>
</tr>
</tbody>
</table>
Upvotes: 2