Jane
Jane

Reputation: 987

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;
   }

Upvotes: 2

Views: 1401

Answers (1)

Jmh2013
Jmh2013

Reputation: 2777

You can use the css attribute selector.

td[headers="blue"]{
    background-color: #1374bf;
}

Upvotes: 3

Related Questions