By default, a WordPress theme's stylesheet only applies to the front end, so the block editor and the published post rarely look alike. Loading a dedicated editor stylesheet closes most of that gap. The bundled Twenty Twenty theme already demonstrates this: open its editor and you'll see light styling applied to the content area.

The setup involves two pieces of work: a small PHP addition in the theme's functions.php that registers an editor stylesheet, and the stylesheet itself. If you're customizing a theme you don't maintain, build a child theme first and make both changes there.

Registering the stylesheet

Open functions.php in the root of the theme folder and append the snippet below. It enables editor-styles support and points WordPress at the stylesheet file.

// Gutenberg custom stylesheet
add_theme_support('editor-styles');
add_editor_style( 'editor-style.css' ); // make sure path reflects where the file is located

That is all the PHP required. The add_theme_support function is documented in the WordPress developer reference if you want the full list of options.

Writing CSS that reaches editor blocks

Create editor-style.css in the theme root (or the child theme root) and fill it in. Standard element selectors are not enough: a plain h2 rule in this file will not change the text size of <h2> elements inside the post.

h2 {
  font-size: 1.75em;
}

Editor styles have to target blocks rather than bare elements. To size a heading, scope the selector to the editable rich-text container:

Showing the block editor with a light yellow background, a heading that reads Holly Dolly, and a heading 2 with DevTools open to the left in dark mode and a block-editor-rich-text-__editor class highlighted in red.
It just takes a little peek at DevTools to find a class we can latch onto.
h2.rich-text.block-editor-rich-text__editable {
  font-size: 1.75em;
}

A file covering the common block editor elements with this scoping pattern is available on GitHub; replace its rules with values that match your own theme. The most practical approach is to start from your front-end stylesheet and copy rules across, adjusting element classes where they need to apply inside the editor window. If a rule seems not to take effect, inspect the element with the browser's DevTools to identify the classes in play.

Before and after

An unmodified editor renders content with default Gutenberg styling:

Showing the WordPress block editor without any custom styling, which is a plain white screen with black text including a heading one paragraph, a blockquote and a black rounded button.
The block editor sports a clean, stark UI in its default appearance. It’s pulling in Noto Serif from Google Fonts but everything else is pretty bare bones.

The front end of the same test site looks quite different — gradients, a custom font, styled buttons and blockquotes, and containers that aren't strictly square:

Showing a webpage with the same heading, paragraph, blockquote and button, but with styles that include a red-to-orange gradient that goes left-to-right as a background behind the white heading, a typewriter-like font, the same gradient to style the blockquote borders and text, and to style the button.

Once the custom stylesheet is loaded, the editor content area matches the front end: content width, fonts, colors and individual elements all line up, including the background treatment behind the post title.

The same look as the custom styles on the front end but now displayed in the WordPress block editor.

The practical payoff is editing without a second browser tab open for previews. Two changes — the PHP registration and the editor stylesheet — are enough to get there.