CSS In Gutenberg editor

CSS Needs minimum selector

.wp-block{}

Load CSS in Editor

<?php

function enqueue_custom_editor_styles() {
	wp_enqueue_style(
		'in-editor',
		get_stylesheet_directory_uri() . '/editor.css',
		array(),
		filemtime( get_stylesheet_directory() . '/editor.css' )
	);
}
add_action( 'enqueue_block_editor_assets', 'enqueue_custom_editor_styles' );

Load CSS in Theme (Front End)

<?php

function enqueue_custom_block_styles() {
	wp_enqueue_style(
		'in-theme',
		get_stylesheet_directory_uri() . '/editor.css',
		array(),
		filemtime( get_stylesheet_directory() . '/editor.css' )
	);
}
add_action( 'enqueue_block_assets', 'enqueue_custom_block_styles' );
Click to Copy