How can I make new .css file in child theme override styles in child theme’s style.css

You can enqueue your own stylesheet by adding this to your child theme’s functions.php file:

function wpa_custom_css(){
    wp_enqueue_style(
        'wpa_custom',
        get_stylesheet_directory_uri() . '/responsive.css'
    );
}
add_action( 'wp_enqueue_scripts', 'wpa_custom_css', 999 );

This will load the file responsive.css located in your child theme directory. The priority is set very low (999) so it is more likely to appear after other styles which may be enqueued on the same action.

Leave a Comment

tech