Simple way to style posts of a single category differently in the loop and in single

I’m not sure I understand the question, since the answer seems straightforward, assuming standard templates – it’s conceivable that your theme does not provide the kinds of classes you are asking for, but IMO would be odd.

It is standard practice for theme writers to include the function body_class() which adds different classes to the page’s html body tag, depending on what kind of post or page you are displaying. These classes include things like:

  • archive (for the archive page),
  • blog (for blog or main loop),
  • home (for home or main loop),
  • single/single-post (for single),
  • category/category-[cat-#] (for category).

Depending on which apply, you’ll see different ones listed.

If you want to know what the classes are for your page you can view the source code, and look at the <body> tag at the top.

So you could use .category-punk-rockers to style punk-rockers. in general, .home .category-punk-rockers for main loop, .archive .category-punk-rockers for category archives, .single-post .category-punk-rockers for single posts, etc. Depending on what kind of widgets and extras your installation uses, you may need to create some further distinctions.