WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Should I copy style.css from parent theme to child theme? (7 posts)

  1. John O.
    Member
    Posted 3 years ago #

    I've created a Child Theme for duster. I want to change values such as colors, backgrounds, pixels.To do this, should i copy the css from style.css of the parent theme into the new style.css for my Child Theme? Otherwise I can only see the code i've entered to create the child theme and cant change values of the parent theme.

    Or do I add CSS to the new child theme style.css in order to override values of the parent theme?

    What's the best/correct method?

    Thanks,

  2. dbphte1
    Member
    Posted 3 years ago #

    http://codex.wordpress.org/Child_Themes
    theres a bit in there with exactly what to do with your child theme.

  3. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    I prefer the @import method.

    In your Child Theme's style.css file, immediately after the header information, but before you add any style definitions, add the following line:

    @import(url:"../parent/style.css");

    This will cause your child Theme's style.css to import the entire Parent Theme style.css dynamically (i.e. update-proof).

    Then, simply add definitions for any styles you want to change/override/add.

  4. John O.
    Member
    Posted 3 years ago #

    Thanks Chip. I actually did include the @import URL in my child theme. However, i replaced "parent" with my parent theme's name. Will any CSS i enter in the Child theme's style.css automatically override the parent theme. For example if I just wanted to add borders or change a color. The reason I ask is I was thinking it would be easier if i could see the parent theme's css in order to quickly just change a value or two...

  5. John O.
    Member
    Posted 3 years ago #

    otherwise a beginner user like myself would have to keep switching back to the parent theme's css in order to copy sections i'd like to alter into the child theme's css... hope that makes sense...

  6. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Yes; anything you add after the @import will override the parent (assuming they have sufficient specificity).

    It's easy enough to have the Parent Theme's style.css open in another text editor window/tab, if you need to reference it.

  7. John O.
    Member
    Posted 3 years ago #

    Cool.. makes sense. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic