Home / Uncategorised / Colour by Category

Colour by Category

Matthew L

If you have a card or section you’d like to dynamically colour based on the post category you can do this in Breakdance by using Attributes and a little CSS.

First add a custom class to the element you want to colour ( I find it’s easier to do this on the top element if you have a card ).

Then in Attributes add data-cat and in value select Dynamic Data and the taxonomy of category.

Then in the Custom CSS add the following.

.customClass[data-cat~="categoryNameHere"]{
    background-color:#fff; /* Styling here */
}