• Resolved Nick Wingfield

    (@nick-wingfield)


    I’ve created a child theme so that when my master theme gets updated I won’t lose all my file amends. I’ve followed the instructions on http://codex.wordpress.org/Child_Themes

    My problem is this:
    I understand how to write code for the child style.css file that adds to or overwrites the code on the parent style.css

    But how do I write code that will stop some of the code on the parent style.css?

    For example, on the parent style.css, I have this code:

    p {
      -webkit-hyphens: auto;
      -webkit-hyphenate-character: "\2010";
      -webkit-hyphenate-limit-after: 1;
      -webkit-hyphenate-limit-before: 3;
      -moz-hyphens: auto;
      orphans: 3;
      widows: 3;
    }

    I want to reduce it down to this (i.e. delete lines 2-6):

    p {
      orphans: 3;
      widows: 3;
    }

    How do I do this on the child style.css?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    You’ll have to override the styles, i.e create new styles.

    Thread Starter Nick Wingfield

    (@nick-wingfield)

    Yes but how can I overwrite, say, the line of code:

    -webkit-hyphens: auto;

    On the parent style.css all I need to do is delete it.

    But if I delete it on the child style.css – surely that won’t override the parent?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Yes, if you delete styles on your child style.css file, the parent’s styles will be used instead.

    You’ll have to set it to something other than the value of the parent
    http://webdesign.about.com/od/css3styleproperties/p/hyphens-property.htm

    Thread Starter Nick Wingfield

    (@nick-wingfield)

    Brilliant!

    So all I needed to do was add none; to every line:

    p {
      -webkit-hyphens: none;
      -webkit-hyphenate-character: none;
      -webkit-hyphenate-limit-after: none;
      -webkit-hyphenate-limit-before: none;
      -moz-hyphens: none;
    }

    Many thanks, Andrew – I really appreciate it!

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    And Thanks, Nick, for contributing to the WordPress community 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How do I code child theme style.css to IGNORE some css code in parent theme?’ is closed to new replies.