I want to display different text based on the category/category the code is embedded in, i.e. when the category is .category-rabbitmq.
This changes the background when the category is .category-rabbitmq.
Read more about
This always displays a variable.
Read more about
However, this does not work when only displaying the variable when setting the category:
Read more about
Can you help?
Cannot nest rulesin CSS (canin SCSS). There is afirst public working draftthat allows nesting in CSS, so maybe in the future you will be able to.
So you need to do something like this:
I'm not sure how many levels the
.category-rabbitmq
element has relative tothemainbody
. If you know thatthemainbody
is a direct child of.category-rabbitmq
, then you can be more specific and use the child combinator and optimize:>
SeeCSS Descendant CombinatorsandCSS Child Combinators.