Applying Additional CSS Class To WordPress Block

Additional CSS for WordPress blocks

The Gutenberg block editor in WordPress puts a lot of stylistic controls at your fingertips. However, there may be certain effects you want to customize, but there are no controls or sliders to adjust them. In those situations, you will often need to add some additional CSS properties. WordPress makes it easy to add CSS without requiring that you edit your theme files. In this article, you will learn how to apply additional CSS classes.

There are two important steps in using additional CSS classes:

Note that adding additional CSS will require some basic skills in the CSS language. There are many great tutorials you can follow to get started. However, since the additional CSS editor does not rewrite any critical system files, you can use it all you want without destroying any critical site data. Bear in mind that certain CSS properties can overrule additional properties. So if you notice your additional rules are not taking effect, you might want to use your browser inspector to see how other rules are in effect.

Apply CSS Class To Block

The first step in using additional CSS is to create a custom class and add it to a block. A custom class is your own design, so you can name it anything you want. It would be best to pick something unique to avoid conflicts with other classes in your theme.

  1. Log into the WordPress dashboard
  2. Select a post or page to edit, or create new content
  3. Choose a block by clicking on it
  4. Go to the Advanced dropdown under the block settings on the right of the editor window
  5. Fill in your additional CSS class
    Filling in an additional CSS class

Now your additional CSS class has been applied to the block. However, you will not notice any changes until you add the additional CSS properties to this class. You’ll find out how to do that in the next section.

Add Style To Your Custom Class

To add style to your custom CSS classes, you will need to use the additional CSS editor, located in the customize section of your site.

  1. Log into your WordPress dashboard
  2. Chose Customize under Appearance
  3. Select Additional CSS
    Choose additional CSS
  4. Use the editor window to plug in your CSS code
    WP additional CSS

Tip: if you customize a page you are visiting, you can watch your CSS changes apply in real-time:

Custom CSS – Adding CSS in Older Themes or WordPress Versions

Previous to supporting Full Site Editing (FSE) and block editing in the post and page editor, CSS was added to modify the theme through an option that was called Custom CSS.

Like CSS added through the Additional CSS interface, theme updates would not overwrite CSS added in these sections. If your WordPress theme has not yet been updated to use FSE, then you will most likely see the interface for Custom CSS. This would be the recommended location for adding CSS so that theme updates do not remove your customizations.


Well done! You now know how to add additional CSS to your WordPress blocks. Feel free to drop any questions or comments you have below.

To learn more about editing content in WordPress, check out our tutorials WordPress Blocks!

Looking for more guides? We have over 400 WordPress How To Articles to help you!

CM
Christopher Maiorana Content Writer II

Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.

More Articles by Christopher

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+