I’d like to define a CSS class that means all text inside is treated as though it were surrounded by the <code> tag. (In other words, it looks as though it is code: it doesn’t need actually to have the <code> tags in the source.)
I guess the class should inherit from <code>.
Is this possible?
CSS is purely a presentational language — it can make a DIV look as though it were a CODE element, but it can’t actually add CODE tags. Depending on your requirement, this may or may not work for you. If you only want the looks, yes, you can use CSS. If you want the semantics of a CODE tag, no, CSS can’t do it.
Edit: Since you just want the looks, you can do something like this: