[Resolved] Custom CSS for page hero in one category

Home Forums Support [Resolved] Custom CSS for page hero in one category

Home Forums Support Custom CSS for page hero in one category

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1442875
    Rust

    Hello.
    I need to custom page hero colors just for one category posts only.
    But i can’t, because, i have this custom CSS for all site pages:
    .page-hero {
    background-image: linear-gradient(-30deg,#00004d,#5333ed 49%,#2cd4d9);
    }
    How can i enable this CSS just for one category only?
    .page-hero {
    background-color: black;
    }

    #1442882
    Leo
    Staff
    Customer Support

    Hi there,

    Are you referring to the category archives or single posts under a specific category?

    #1442892
    Rust

    single posts under a specific category

    #1442899
    Leo
    Staff
    Customer Support

    What if you create a separate page hero/header element specific for the single posts in that category using display rules like this?
    https://www.screencast.com/t/IXS4Db6Zx

    #1442901
    Rust

    did, did not help, because i have GLOBAL custom .page-hero css code

    #1442912
    Leo
    Staff
    Customer Support

    The best way would be to add a custom CSS class:
    https://docs.generatepress.com/article/header-element-overview/#element-classes

    For example, if you add a class called gradient, then you can target your CSS specifically:

    .page-hero.gradient {
        background-image: linear-gradient(-30deg,#00004d,#5333ed 49%,#2cd4d9);
    }
    #1442939
    Rust

    Thanks, Leo, great support!

    #1442945
    Leo
    Staff
    Customer Support

    No problem 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.