WordPress.org

Ready to get started?Download WordPress

Forums

CSS Specificity (5 posts)

  1. Distiple
    Member
    Posted 1 year ago #

    How can i make the first rule (in my child themes style.css) to overrride the second one (parents css)?

    Rule #1: #site-description {
    clear: right;
    float: left;
    color: #3D4258;
    font-style: italic;
    margin: 15px 0 18px 0;
    width: 220px;
    font-size: 200%
    font-family: arial;
    }

    Rule #2: #site-description {
    clear: right;
    float: right;
    font-style: italic;
    margin: 15px 0 18px 0;
    width: 220px;
    }

  2. alchymyth
    Forum Moderator
    Posted 1 year ago #

    How can i make the first rule (in my child themes style.css) to overrride the second one (parents css)?

    in what aspects?

    what is not working for you?
    can you post a link?

    generally, the child theme's stylesheet should be loaded after the one of the parent theme, and those styles should automatically overwrite the equivalent styles of the parent theme.

  3. Distiple
    Member
    Posted 1 year ago #

    For whatever reason, this ended up overriding correctly:

    #site-description {
    clear: left;
    font-size: 150%;
    float: left;
    color: #3D4258;
    }

    Not sure I understand why though.

  4. Andrew
    Forum Moderator
    Posted 1 year ago #

    Sounds like you didn't clear your cache when you wanted to see the immediate change.

  5. Distiple
    Member
    Posted 1 year ago #

    Im working with cloudflares development mode, and can see other changes i make. I also didnt clear the cache when it finally worked (perhaps you didnt see my reply posted at roughly the same time as yours).

Topic Closed

This topic has been closed to new replies.

About this Topic