I've just set up a new blog with the twentytwentythree theme. When I go to Appearance - Editor - Styles - Stylebook I can change the default layout of different blocks including Code Blocks. For example, as a test I changed the background color to some bright pink. On my sample post I can see the color affecting regular code blocks. It doesn't work for inline code blocks though. So for example, in a list I add an inline code block to a list item. That piece of code is not colored in pink. What changes do I have to make to be able to format inline code blocks?

Thanks for your help!

1 Answer 1


to style your inline code blocks, you can target the <code> HTML tag using CSS. In WordPress, you can add custom CSS through the Customizer. Here’s a step-by-step guide:

  1. Navigate to your WordPress dashboard.
  2. Go to "Appearance" and then
  3. "Customize". Find and open the "Additional CSS" section.
  4. Add the following CSS to style your inline code blocks:

code {
    background-color: pink; /* Or whichever shade of pink tickles your fancy */
    padding: 2px 4px;
    border-radius: 3px;

Now, your inline code should appear with a hotpink background on the front end of your website. If it doesn't take effect, it might be due to a caching issue, and you might need to clear your website and browser cache. If the issue persists, the existing CSS might be overriding it, and you may need to increase the specificity of your CSS selector.

  • that worked perfectly, thanks for your help!
    – mpr
    Commented Oct 16, 2023 at 8:14
  • @mpr Happy to help! Commented Oct 18, 2023 at 4:19
  • I tried this and it doesn’t work in my case! Additional CSS does affect the multi-line (<pre>) <code> blocks, overriding the block editor, but not what’s shown inline, which always retains the original code formatting of theme — even if I’ve changed it in the block editor. For what it’s worth, I tried also using css for pre, but that had no effect at all. I’m using the GroundWP theme, if that matter, Commented Apr 6 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.