CSS in ID HTML atribute

(lucky) #1

How to add CSS to “ID = 5”?

<tr data-category-id="5" class="has-description no-logo">

(Kris) #2

You can target data attributes with CSS like this:

tr[data-category-id="5"] {
    background: red;

(lucky) #3

This not working(

(lucky) #4

I want each category to have its own background color

(Kris) #5

That CSS works for me on the category page to change the background color — is that where you’re trying to change it? Is it possible to provide a link to the page you’re trying to change?

(lucky) #6

How do I give my background color to each category?

(Kris) #7

Hmm, I’m not quite sure why the provided CSS wouldn’t work for you… here’s an example I’m able to build.

(lucky) #8

Thanks! It works :grinning:

(Joffrey Jaffeux) #9