WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] In child style.css remove line from parent style.css (6 posts)

  1. wperic
    Member
    Posted 2 years ago #

    I've found a couple of places in theme discussions where the advice on how to change the theme included removing certain lines or parts of certain lines from the style.css.

    I take it that I can solve the 'remove parts of certain lines' by just including the edited line in the child style.css. (It's not clear that this works, though. I suspect I haven't actually deleted anything by doing this.)

    But what do I do in the child style.css to effect the removal of an entire line from the parent style.css? Best practice says I shouldn't just go into the parent style.css and delete or comment out the lines.

  2. Ross Hanney
    Member
    Posted 2 years ago #

    Hello,

    You can't remove anything from the parent style.css within the child style.css, but you can override it.

    For example, say the parent style.css contained the following:

    #something .something-else {
    	font-weight: bold;
    	color: #f00;
    }

    And you didn't want the bold and red styling, you'd add the following to the child style.css:

    #something .something-else {
    	font-weight: normal;
    	color: #000;
    }

    That would override the parent styling.

  3. wperic
    Member
    Posted 2 years ago #

    OK.
    Thanks.

  4. Blurazor
    Member
    Posted 2 years ago #

    Hi, I am in a similar situation where a styling in the parent style.css is causing havoc. So just to be sure, there is no way to remove the culprit styling in the parent style.css except to comment it out?

  5. Ross Hanney
    Member
    Posted 2 years ago #

    Correct, but as mentioned above, you can override anything you like.

  6. Blurazor
    Member
    Posted 2 years ago #

    Thanks for your help Ross.

Topic Closed

This topic has been closed to new replies.

About this Topic