Conditional styles?

I’m curious, is it possible to do “conditional styles” in OO?

With this I mean if I can have different styling on the same item level that depends on the content of the parent of these items.

Hypothetical example: If a level 1 item represents a class and on level 2 have the items “Methods” and “Attributes”, and level 3 contains the methods/attributes. Is it possible to get OO to automagically detect that I have “Method” on level 2 and style the level 3 items in a different way than the level 3 items of “Attributes”.

(Yes, I can do it manually but …)