How can I format an inline code
in Confluence like this
? I mean, not a separate code block, but just inline classname
, for example.
To insert inline monospace font in Confluence, surround the text in double curly-braces.
This is an {{example}}
.
If you're using Confluence 4.x or higher, you can also just select the "Preformatted" option from the paragraph style menu. Please note that will apply to the entire line.
Full reference here.
By default Confluence renders monospaced text with transparent background. You can edit global CSS to add grey color. From Confluence manual:
Custom CSS for displaying grey background in monospaced blocks:
code { padding: 1px 5px 1px 5px; font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif; background-color: #eeeeee; }
If you're using Confluence OnDemand (cloud):
{style}
blockPaste the following:
{style} code { padding: 1px 5px 1px 5px; font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif; background-color: #eeeeee; } {style}
After that you'll get nice and tidy stackoverflow-stylish inline code spans just by writing {{sometext}}
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With