How can I format an inline code in Confluence like this? I mean, not a separate code block, but just inline classname, for example.
inline code
like this
classname
All of these other answers certainly sound like good ideas and I would recommend using them first, but I will go ahead and add one more to the list for completeness' sake.
You could simply use the html macro and then paste your content wrapped in tags.