Jane Jane - 1 year ago 78
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;

Answer Source

You can use the css attribute selector.

    background-color: #1374bf;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download