Dynamic background color for categories?

  • Author
  • #109335


    I’m thinking this can’t be done, but I was hoping the experts could step in and confirm.

    I’d like to make the background color change depending on what category the person is viewing. While CSS seems pretty powerful for modifying different sections of a page, I don’t see that there’s a tag or trigger that keeps track of which category is currently being viewed.

    Any help would be appreciated. Thanks!


    that’s the beauty of the sandbox theme. it’s the only theme that applies categories as classes.

    so you can use

    body.s-category-blogging {
    background: blue;

    for example.

    categories are also applied to posts, so you could use

    div.category-blogging {
    background: blue;

    you can read more about it here:



    Thanks for your help, sunburnt. Here is my $1,000,000 question.

    I like the category navigation bar that you get with Ambiru, Blix, etc. Is it possible to code for something like this in Sandbox as well? I’m thinking you could use a text box with HTML, essentially borrowing the code from another theme, but I could be way off.


    actually, as long as you use the “NoStylesheet” skin in the sandbox skins menu, you’ll have the menu.

    if you want to use one of the standard layouts as a base, you can just copy the css into your edit css page

    you can get the stylesheets here: https://s-ssl.wordpress.com/wp-content/themes/pub/sandbox/skins/2c-l.css
    (the Global Navigation: N flag is the reason you can’t just use the skin menu)



    sunburnt, thanks to your help I have a fairly close approximation of where I want to go with my blog. It can be found here: deepleft.wordpress.com. I highly recommend viewing in Mozilla if possible (I’ll work on making it IE-friendly in time).

    I was hoping someone could help me with 2 issues at this point:

    – my left sidebar (class “primary”) ends abruptly after all the widgets are shown, but I want it to extend to the footer. I thought “height: 100%” in the CSS would do the trick but no dice. I would like to extend it consistent with the “content” class it borders.

    – I’m having issues using “float.” I can float my primary sidebar to the left (hurray!) but can’t get my content box to run up against it. I’ve tried A LOT to get this to work (including removing floats and all sorts of crazy stuff). Any thoughts?

    Note: everything was done in the Sandbox no-CSS theme. Thanks for your help!


    yeah, height: 100%; would be beautiful if it worked.
    a list apart has the cannonical solution:

    otherwise you can pester atthe404 to see if he can explain his gemini theme to you, which does two full-length columns.

The topic ‘Dynamic background color for categories?’ is closed to new replies.