good question! Basically, in your enqueue you call the Parent stylesheet first then the child, so any child styles (by definition of css specificity) will override the parent styles.
Code example from the WordPress codex: https://codex.wordpress.org/Child_Themes
<?php
function my_theme_enqueue_styles() {
$parent_style="parent-style"; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>
Related Posts:
- Child Theme Not Overriding Parent Theme
- Setting Up Child Theme To Take Priority
- remove_action on after_setup_theme not working from child theme
- How to load scripts/styles specific for a page
- Child theme – Overriding ‘require_once’ in functions.php
- Echo tags used to describe the theme
- Child Theme files – what is needed?
- Problem only while using require_once() within functions.php
- Please Explain the Importing Process of Multiple Stylesheets for Child Themes
- Some questions about how proper add 2 CSS file in a WordPress theme?
- Can’t switch to a child theme using filters template, option_template and option_stylesheet
- Parent theme styles overriding child theme CSS [closed]
- Default Nav Highlight
- get_template_directory_uri() links to child theme not parent
- How to override this theme function in child theme
- get_template_directory() – references parent theme directory
- CSS style and app.js not loading
- Child Theme not loading multiple stylesheets
- Help with is_page() and calling css for specific pages in a Child Theme
- Getting back a blank WordPress site following functions code edit
- Preventing PHP Execution in Parent Theme
- Random text changing to weird icons in both admin & front end
- Functions.php in child theme that loads CSS file breaks website
- How do I make my child theme’s CSS update when I save it?
- get_template_directory_uri pointing to parent theme not child theme
- functions.php inject inline css
- One Child Functions.php for Multiple Child Themes
- Removing custom background and header feature in child theme
- Logout/login redirect CSS issue
- override parent theme configuration in child functions.php
- which is the function that removes accented vowels?
- Function in Child Theme not overriding Parent Theme function [duplicate]
- Is it possible to be more page/post specific with admin_enqueue_script?
- Enqueue styles after a plugin
- Where does function_exists() look to decide whether a function exists? [closed]
- Child theme functions.php not executing
- How to add background image control to page admin controls?
- How do I copy my Parent Templates to my Child Templates?
- Make “sidebar template” the default template for new pages
- wp_enqueue JavaScript in child-theme (ReferenceError) using Search & Go
- Add class or ID to any WordPress function
- How to load parent theme style.css?
- How to remove howdy dropdown menu content
- Best practice when altering a parent theme function inside a child theme?
- Enqueue Style Only On Certain Pages Not Working
- Why does the ‘wp_nav_menu’ function work only until a menu is created?
- Creating a child theme – functions.php code issue
- How to style options page in dashboard?
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- Overwriting Parent Theme’s Image Sizes
- Translation of theme using child theme
- Twentyten Child Theme: header images display messed up in admin panel
- Theme functions.php file auto delete everyday [closed]
- change the url paths in the stylesheet dynamically
- Parse error after modifying the template menu [closed]
- Reuse variable in hook callback
- How to load parent theme template parts in child theme
- Custom styles.css sheet for visual editor
- Running script based on Category
- Is my code correct to enqueue CSS on a specific page?
- Child theme’s stylesheet cannot load [closed]
- Got white blank page after copying the functions.php to child theme
- What’s the default order used by WordPress to load CSS files?
- Randomizing wp_tag_cloud() in child theme
- Redirect website domain (including all pages) to external URL after Popup message (few seconds)
- Where do I go to edit this area? [closed]
- How to insert class in each list of categories?
- I can’t add CSS with functions.php
- This code works, but the way I integrated it is breaking the media uploader. How can I integrate it properly?
- How to remove admin footer text from inside child theme?
- How to overwrite template.php file
- remove_action not working, even after changing priority [duplicate]
- remove/hide wp-editor
- How to use parent theme functions in child theme functions.php file?
- Removing parent theme CSS without editing parent theme
- Change custom featured image size in twentythirteen child theme
- Include widget file in functions.php of child theme
- remove_action from parent theme using child theme functions.php
- How to reference different css (bootstrap) stylesheets for the header and body of a page?
- Can we have conditional CSS styling?
- Post content overflows on my mobile phone
- How to add javascript code into Divi child theme?
- function class doesnt work
- how to remove a tag in the_category function
- How can I fix my theme header for my CSS stylesheet?
- Adding custom html/css/images to Theme
- Adding a class to the body of an inactive site using multisite
- Conditionally apply css for a specific template part
- How to automatically add custom classes to headings in content area
- uninstall a theme programmaticlly
- us states dropdown function and echo in theme template files
- Update add_image_size
- Load a Child Theme’s style.css just before the closing tag
- functions.php / replacing div’s with new ones?
- Child Theme not working – CSS gone
- Which template file to edit to edit homepage in Mystile [closed]
- How to fix enqueue_styles error for a twenty-seventeen childtheme
- wp_head not injecting css
- Custom Theme Additonal CSS “” are transformed to “>” and “<”
- post_row_actions filter from parent theme not executing in child theme