By default, when you add an image gallery shortcode in WordPress, it’ll automatically include some inline CSS for the gallery. If you want to customize or add your own styling for the gallery, then you need to disable the default inline CSS.
Instructions: Add the following code to the functions.php file of your WordPress theme.
add_filter( 'use_default_gallery_style', '__return_false' );
You may also enjoy using custom CSS for WordPress editor.