Jane Jane - 1 month ago 13
CSS Question

Assign CSS class to <td> based on header info

Is there any way I can assign a css class to a table cell merely based on its header attribute?

The code is generated dynamically through a CMS so it's a little difficult to change, and it basically looks like this:

<td headers="blue">

How can I assign the style below to the td?

background-color: #1374bf;


You can use the css attribute selector.

    background-color: #1374bf;