WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Which .css file to use? (5 posts)

  1. moeryan18
    Member
    Posted 1 year ago #

    Hi everyone,

    I want to make sure I am staying organized during the creation of my first wordpress website. I don't want to have any duplicate files or files that do not 'matter'.

    I'm using 'A thematic child theme' and I'm only in the basic editing of my style sheet now; however, I just became confused. Do I want to be editing the 'default.css' file? Or does everything I put into my 'style.css' file overwrite that? I just noticed that in my 'thematic child' style.css file, it has this comment:

    "/* It's better to actually copy over default.css into this file (or link to a copy in your child theme) if you're going to do anything outrageous */"

    I'm not sure what this means/what is considered 'outrageous'. I'm making a site from scratch...should I delete the default.css file? It's confusing me because when I am logged into my cPanel File Manager, there are so many files...I'm not sure which ones need to stay...because I don't want to have a bunch of unused files sitting there...I only want the ones that are being used.

    Sorry so long, and hopefully this post makes sense.

    Many thanks to you for reading this.

  2. Gene
    Member
    Posted 1 year ago #

    With child themes, you never want to directly edit or remove any of the parent theme's files (in your case Thematic). What you do in you child theme is perfectly acceptable.

    There are several @imports in the style.css of it's bundled sample child theme. Those imported styles will give you a head start on your child theme's styling and that's a good thing.

    IMO, the "outrageous" mention suggests that if your child theme deviates drastically from the @imported Thematic stylesheets then you might want to remove the @import statements and cherry pick the styles you desire from the framework or start fresh on your own in your child theme. I tend to do this when I find that the overriding of Thematic's @imported styles using CSS inheritance and specificity becomes overcomplicated.

  3. moeryan18
    Member
    Posted 1 year ago #

    Thanks for your response, Gene.

    I think I understand what you mean regarding the @imports giving me a 'head start'...I wasn't using them yet though.

    So, to be clear, it would be a good idea to use those @import css files to assign the design details, instead of consolidating all of them in one style.css sheet? Those files are all located under the 'thematic' directory though...which would be the parent theme.

    Here is an example of what my style.css file is telling me to do:
    ---------------------------------
    /* Apply basic typography styles */
    @import url('../thematic/library/styles/typography.css');

    /* Apply a basic layout */
    @import url('../thematic/library/layouts/2c-r-fixed.css');
    ---------------------------------
    Sorry this is so long again...I'm just confused as to whether I should edit those above files (but you said it's not a good idea to edit the 'parent' files) or only use my style.css file.

    Thanks again, Gene! Much appreciated.

  4. Gene
    Member
    Posted 1 year ago #

    Just to be clear you should not ever edit the parent's files, in this case Thematic.

    You should only make edits to your child theme's files.

    By editing the parent theme's files, you'd risk losing your customizations upon upgrading Thematic in the future. Upgrades to Thematic are inevitable and will be made to provide it's compatibility with WordPress and WordPress theme standards as they evolve. So you should always keep your parent theme up to date.

    If you feel the need to drastically change the @imported styles *but* you still want to experiment with using them...

    Then you'll want to remove the @imports from the child theme's stylesheet and copy the content of those parent stylesheets into your child theme's style.css *or* copy the files into your child theme directory and @import them from within the child theme.

  5. moeryan18
    Member
    Posted 1 year ago #

    Great, I think this is a good explanation for me. I'll stick to only editing my child theme - not the parent. And I'll make sure my parent theme stays up-to-date.

    Thanks Gene, I greatly appreciate your time.

Topic Closed

This topic has been closed to new replies.

About this Topic