I want to add background
to the row of a table where one of its columns is: Value 1 . I tried using pseudo-class contains and innerHTML
but all to no avail.
Code:
table tr td [innerHTML="Valor 1"]{
background: red;
}
table tr td: contains('Valor 1'){
background: red;
}
<table>
<tr>
<td>Valor 1</td>
</tr>
<tr>
<td>Valor 2</td>
</tr>
<tr>
<td>Valor 3</td>
</tr>
</table>
- How can I use a CSS selector to select the line by column text?
- In a more general way, how could you select a element by its content?