Alex Rivera | Logout

html table set some cell text colours based on value

Asked 2011-02-02T22:22:28.093
14

I have an html table and in a particular column the text is either set to 'Y' or 'N'. I'm wondering if it is possible to set the colour of the text to Red programmatically on load if the value is'N'?

<table>
    <tr>
        <td>N</td>
        <td>Y</td>
    </tr>
</table>
Edit
Report

1 Answer

7

Try the following CSS:

td[value="N"] {
    color: red;
}
answered 2011-02-02T22:26:55.740

Your Answer