child theme customizations not overriding parent theme CSS

1) I edited the parent theme CSS and the changes took.
2) I moved those edits to the child theme, activated it, set the parent theme back to default (i.e. before my changes), and the changes went away.
3) I added some new CSS (classes and other stuff) and those changes worked well, but the CSS changes that also exist in the parent CSS (base.css) don't work.

Why? How to correct this?

    marikamitsos

    Hi Clifford,
    We haven't tried your way (at least not yet). I don't know if this would make any difference, but we usually "follow the suggested" way.

    /* begin child theme css style here */
    /*
     rename this to child-style.css
     any custom css can be input here to prevent any css edit missing when version updates to themes
     to effective overide some css used #custom first id hack
    
     sample:
     #custom .myclass {}  or used !important for better css hack overide
    
     sample
     #custom .myclass {
     color: #fff !important;
     size: 14px !important;
     }
    
     try not to touch the css from other stylesheet for better and easy updates.
    *

    Can you please try it? You will find these instructions @ child-style-sample.css

    Please let us know if you need further assistance. We are here to help. :)
    Thank you for your time,
    marikamitsos.

    Should you find the provided solution satisfactory, please mark the topic as resolved.
    Thanks again, marikamitsos

    Clifford P
    • Elite
    • 796
    • #115

    yes, exactly what I did, except in a round-about fashion. lol. sorry for the confusion.

    aecnu

    Greetings Clifford,

    Do you have the new css that you created in the child themes _inc/css/ folder?

    This is where I found on my install that the custom css style should reside.

    Please advise.

    Cheers, Joe :-)

    Clifford P
    • Elite
    • 796
    • #115

    http://ScrnSht.com/hdxxcq
    -check mark on things that didn't exist in parent theme --> these rules work
    -circled the section that doesn't work, since the selectors are the same in the parent theme --> these rules don't work
    -highlighted that I am in the child theme.

    marikamitsos

    Have you noticed that since:

    IMPORTANT UPDATES
    - All styles and js scripts are now loaded in wp_print_style() and wp_enqueue_scripts() in functions.php

    why don't you give it a try and:

    but the CSS changes that also exist in the parent CSS (base.css) don't work.

    also save those changes to the child theme?

    Just a thought

    aecnu

    Greetings Clifford,

    I am more then happy to see about getting the developer in here to advise/assist in getting this handled.

    Meanwhile I suggest as a last resort to protect your custom code, in the base or parent folder css where you made your custom changes that work, permission the customized file 444 read only so that it cannot be overwritten during an update or by FTP.

    I have gone ahead and sent notification for the lead developer of Edublogs Homepage theme to come in here and check this out.

    Cheers, Joe :-)

    Clifford P
    • Elite
    • 796
    • #115

    As I said, I essentially didn't make any changes to parent, only to the child.

    Patrick

    Hi Clifford,

    If your custom additions are working, then your child-style.css is being loaded properly. If your overrides are not working, you simply need to increase their specificity. You have 2 ways to do this:

    1 - add !important to each property like this:
    .top-h-content { margin:0 !important }
    2 - or add #custom to each selector.
    #custom .top-h-content { margin:0 }
    Note that #custom is the ID of a div that wraps everything in most, if not all, WPMUdev child-themes to allow for just this type of override.

    Hope this helps! :-)

    Clifford P
    • Elite
    • 796
    • #115

    Ok, I was on the computer way too long yesterday.

    I confused myself and thought I copied the mods to the child but I copied the original base.css to the child. In the process, I lost my (albeit few) mods.

    To confirm my error, I redownloaded EduClean and compared my child rules to those found in there and, sure enough, that was what I did.

    So, no !important (thankfully) and no #custom (nice that it's built in, glad to know about it now, but glad I don't need it).

    So, thanks for your efforts. Hopefully I won't do this again anytime soon. :)

    marikamitsos

    Ok, I was on the computer way too long yesterday.

    That's why

    we usually "follow the suggested" way.

    and NOT the: "exactly what I did, except in a round-about fashion." way which has caused us much more serious losses on long nights. :(

    Anyway... Glad it was easily solved. :)

    Patrick

    exactly what I did, except in a round-about fashion

    As my dear ol' Dad used to say with a wink and a comforting smile:

    If all else fails... read the instructions.

    :-)

Join 378218 happy members

Get access to our entire collection of epic plugins, astonishing themes & genius support

Become a member