Create Custom Styles for Gutenberg Blocks

The PublishPress Blocks plugin allows you to define custom CSS snippets that can be applied to any block when you're creating a post.

This is a very useful that empowers your users to add pre-defined CSS styles to any block.

The default styles in PublishPress Blocks

PublishPress Blocks gutenberg custom styles

How to create custom styles

  • Click on the “Add new class” button at the bottom of the list of styles.
Screen Shot 2020 12 10 At 12.46.27
Add a new class
  • Choose a name for your new class:
Screen Shot 2020 12 10 At 12.47.57
New Class Name
  • Choose the “Style class”.
  • Choose an “Identification color” so your users can pick the style.
  • Edit your CSS right in the Custom CSS field.
Screen Shot 2020 12 10 At 12.49.15
My New Class
  • All the changes you make will be displayed in the “Preview” area. The text above and under the string displays how your default styles.
  • After editing your custom style, save it using the “Save Styles: button.

How to use custom styles with specific blocks

The easiest way to use custom styles is with the blocks below:

  • Paragraph
  • Heading
  • List
  • Code
  • Preformatted
  • Table
  • Columns
  • Group

To add a custom style:

  1. Select a block.
  2. In the right sidebar, choose a style from the dropdown list named “Custom styles”. 
  3. To revert to the default style, choose the “Paragraph” option.
Screen Shot 2021 06 18 At 12.33.28

How to use custom styles with other blocks

You can also add your CSS styles to other blocks different to the listed in the previous section.

  • Use the “Advanced” area to enter your custom style in the “Additional CSS class(es)” box:

In the center of the screen, you should see that the block has your new CSS style. In the image below, the blue-message CSS is active.

Blue Message
Blue Message
  • Here is that same block on the frontend of WordPress:
Blue Message Front
Blue Message Front

Professional publishing plugins for WordPress! Get PublishPress