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

    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 :-)

    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 :-)

    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

    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. :)

JOIN 388273 HAPPY MEMBERS

We pride ourselves on our level of customer support and responsiveness to member requests. Your WordPress experience will never be the same


Become a member

  • PayPal Partner