woocommerce.css overriding child theme style.css
-
I’ve set up a child theme with Storefront as the parent and the woocommerce plugin active, which I’m trying to learn my way around. I thought I’d start with something very simple: changing the position of the site title so that it sits to the right of the page rather than the left. Initially I tried the code `.woocommerce-active .site-branding{
float: right;
}`
in the child’s style.css file but I noticed that the css file “inc\woocommerce\css\woocommerce.css” in the Storefront parent directory contained the code.woocommerce-active .site-branding, .woocommerce-active .site-logo-anchor { float: left;
which was overriding it. I fixed it by changing the code in the child style.css to
.woocommerce-active .col-full .site-branding{ float: right; }
and it worked, but I was wondering why code in the woocommerce.css file took precedence over the child’s style.css file? In the child’s functions.php I’ve copied
<?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { 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') ); }
from https://codex.wordpress.org/Child_Themes and I thought that the child css file was loaded last and would therefore override parent code in this case? Sorry if this seems like a silly question!
- The topic ‘woocommerce.css overriding child theme style.css’ is closed to new replies.