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
- How to customize the_archive_title()?
- How to override parent functions in child themes?
- Adding a second email address to a completed order in WooCommerce [closed]
- Is there any global functions.php file which works for any theme?
- Include files in child theme functions file
- Display random categories on the front page (Finding and Editing Theme Functions)
- Redeclare a function in a child theme
- How to override a function when isn’t at functions.php
- Child theme functions.php do I use php open and close tags?
- functions.php inject inline css
- Issue with get_theme_mod returning a blank value instead of the saved value
- Declaring an instance of class included in parent theme from child theme functions.php
- One Child Functions.php for Multiple Child Themes
- Removing custom background and header feature in child theme
- How do I create a new WP admin color scheme?
- How to override function in functions.php of parent theme?
- Logout/login redirect CSS issue
- Implementing DNS Prefetching with WordPress
- Hourly Routine Not Firing ( wp_schedule_event() )
- override parent theme configuration in child functions.php
- Child theme – overriding add_image_size by a child theme [duplicate]
- syntax for remove_filter in parent theme with class
- Is it possible to override this function/class in a child theme?
- Add attribute to link tag that’s generated through wp_register_style?
- How to override functions.php in child theme?
- which is the function that removes accented vowels?
- Overriding core functions in child theme
- TinyMCE custom stylesheets for different post types
- Override parent theme function that is not hooked or in the functions.php file
- Function in Child Theme not overriding Parent Theme function [duplicate]
- Change parent theme file function in child themes functions.php
- Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons
- Theme Demo in live Site
- Remove “says” from comments
- Reuse variable in hook callback
- Child theme – copied some files from parent to child website still uses parent files
- Customising widget titles/headings in WP 5.8
- How to add CSS style sheet dynamically in wordpress
- Getting rid of unused css directives [closed]
- Simple/basic use of get_current_screen
- How to override filter in child theme?
- I created a child theme and it doesn’t work for some of the css files
- unregister_sidebar in child theme not working
- Unregistering custom tinymce plugin?
- Override parent theme function that is not hooked or in the functions.php file
- Syling Custom Fields echo’s from from functions.php
- How does child theme functions.php work with parent theme functions.php? Is it like CSS? [duplicate]
- functions.php / replacing div’s with new ones?
- Additional Sidebar
- adding navigation to genesis themes
- Child theme after CSS modification
- Should I use `get_stylesheet_uri()` or `get_template_directory_uri()` when calling my CSS Stylesheet?
- Problem with Child-Theme using of foundation-framework [closed]
- How can I append and prepend something to all post hyperlinks without using ::before or ::after? PHP hook solution?
- Child Theme not working – CSS gone
- Image width issue in IE [closed]
- Add custom css to theme
- Why functions metaboxes is causing White Screen in Admin [closed]
- Which template file to edit to edit homepage in Mystile [closed]
- Adding function to function.php error 505 [closed]
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?
- How to get postId from the argument $block when register_block_type()?
- How to fix enqueue_styles error for a twenty-seventeen childtheme
- My website is generating weired url parameters of paginated pages
- how to display custom taxonomies in front page
- wp_head not injecting css
- Custom Theme Additonal CSS “” are transformed to “>” and “<”
- How to automatically load Google Fonts on pages only as they’re used?
- post_row_actions filter from parent theme not executing in child theme
- Proper way to load styles using a child theme
- How to use webpack in WordPress theme? I want some scripts to load in the footer, some in the header and some with script parameters
- Child theme’s functions.php not being read (child theme’s autoload.php not being run)
- Override categories with Pages (block theme)
- Add custom css to specific user
- i recently bought a theme and when i try to activate it says (It appears wp_remote_get() function is disabled in your server. )