I am using latest wordpres. I have created child theme.

I am trying to overwride the .box style of parent theme but it is not overriding it. If i do this in parent themes style.css it works.

//This is style.css of child theme
Theme Name: Custom Theme
Description: Child Theme
Author: Shahrukh
Template: basetheme
Version: 0.1
.box {
    width: 600px;
    max-width: 75%;
    /* padding: 4rem; */
    margin: 0 auto;
    border: solid 1px #fff;
    border: solid 1px hsla(0, 0%, 100%, .3);

This is function.php of child theme

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') );

require get_stylesheet_directory() . '/myGallery/gallery_functions_include.php';

  • 1
    do you see these 2 stylesheets in the HTML source ?
    – mmm
    Aug 6, 2015 at 7:59

2 Answers 2


Is this: / just overwritten or is it a mistake in your code? max-width: 75%;/

It might cause to not work properly. Otherwise i will try a bit shady way, try to make your parent attributes !important.


I actully figured out the problem. I did not want the padding porperty i.e padding: 4rem;. So instead of overriding it in child them as padding: 0rem; I did not mention it. Therefore that property was not being overridden.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.