How to change the background colour of a word in InDesign | Stack Exchange

I'm using InDesign increasingly it seems and overall I really dig it, but I recently ran into a fairly simple problem that doesn't have an official solution: inline code styling. It's pretty much a standard these days to highlight inline code with a background colour, something like this: <strong>. However, InDesign doesn't allow you to set background fill for a single word (or partial string of any kind).

Luckily, there is a workaround, which I found thanks to the user Wolff over on Stack Exchange. You use a ridiculously large underline effect to mimic a background (with non-breaking spaces for additional padding). Just select the word or phrase, go to the Character Style menu and edit the Underline Options like so:

Screenshot of Character Style Options panel in InDesign, with Underline Options selected. Underline is checked to "on", weight has a value of "13pt", type is a bold line, tint 100%, and color is set to a green. All other options are deselected.
Little tip: whilst setting up your inline code style, don't forget to save it. Makes applying it throughout a document incredibly simple.

Explore Other Notes

  • <!DOCTYPE html> <html> <head> <title></title> </head> <body> <p>I'm using InDesign increasingly it seems and overall I&nbsp;really dig it, but I&nbsp;recently ran into a fairly simple problem that doesn't have an official solution: inline code styling. It's pretty much a …</p> </body> </html>
  • Murray Adcock.
Journal permalink