Among its many benefits, WordPress offers extensibility like no other content management system. It now powers 40% of the world’s websites, and there are no signs of slowing down.
With the release of the new block editor known as Gutenberg, developers can customize settings and control the way a user interacts with the software.
An example of this is block font sizes, which allows users to choose from a selection of options that are given to them.
WordPress Block Editor Custom Font Sizes
The code snippet below will allow you to enable custom font sizes for the WordPress block editor. This should be placed in the functions.php file of a theme.
When custom font sizes are added by a theme, a unique class is given to them. The class name is built appending ‘has-’, followed by the font size name and ending with -font-size.
The code snippet below will allow you to provide CSS styles for custom font sizes for the WordPress block editor. This should be placed in the style.css file of a theme.
To learn more about enabling custom font sizes and building WordPress themes, check out the Block Editor Handbook.