CSS in ID HTML atribute

Hello!
How to add CSS to “ID = 5”?

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

You can target data attributes with CSS like this:

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

This not working(

I want each category to have its own background color

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?

How do I give my background color to each category?

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

9 Likes

Thanks! It works :grinning:

1 Like