Code Block

Great for showing code snippets, the code block maintains spaces & tabs, allowing you to write HTML, CSS, JavaScript, PHP or just about any type of technical code.


The code block is for writing technical pieces of code. It maintains all spaces and tabs so your code is rendered exactly as you type it.

Code Block Settings

Code blocks only support one additional setting:

  • Additional CSS Class

There are no formatting styles, such as bold, italic or strikethrough, nor can you add links.

You cannot switch a code block to any other type of block.

Code is just that: code. Nothing more, nothing less.

Code Block Styling

Your code will be styled by your theme, but typically it will be displayed in a monospace font.

Learn About Other Gutenberg Blocks

Scroll to Top