[Resolved] discriminate a different header from "Elements" on desktop and mobile

Home Forums Support [Resolved] discriminate a different header from "Elements" on desktop and mobile

Home Forums Support discriminate a different header from "Elements" on desktop and mobile

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #980193
    Patricia

    Hello!

    Is it posible with the “Elements” feature to place a header only for desktop/mobile? if it is, how?

    I want to place a title and an image on the frontpage of my blog, which i already did placing a header but it is not very well displayed on mobile so i want to place a different image just for mobile

    Thanks!

    #980213
    Leo
    Staff
    Customer Support

    Hi there,

    Looks like you are referring to static images so you can insert 2 images and just use the built-in hide-on classes:
    https://docs.generatepress.com/article/responsive-display/#using-our-hide-on-classes

    Let me know if this helps 🙂

    #980842
    Patricia

    hello!

    it worked perfectly, but y need to change the responsive breakpoints for tablet, just for this, not for the rest of the site…

    what code should i use?

    i’ve tried as follows but it does not work (sorry i know almost nothing about CSS:

    <div @media (min-width: 1025px) {
    display: none;
    }>

    #980924
    Leo
    Staff
    Customer Support

    Not quite sure if I fully understand.

    So you are trying to change the breakpoint of where the image switch?

    #981084
    Patricia

    hello again Leo

    yes, for example mobile until 449px, tablet from 450px to 799px and desktop from there

    but just for this, not for the rest of the settings of the template

    is it possible?

    thanks

    #981203
    David
    Staff
    Customer Support

    Hi there,

    to change out the background image would require some CSS like so:

    @media (max-width: 450px) {
        .my-hero-custom-class {
            background-image: url(full_url_to_image/image.jpg);
        }
    }

    Give the header an Element class of my-hero-custom-class or whatever you want to name it to target that one specifically.

    #981205
    Patricia

    hi David! it’s not the background image..it’s a “banner” image I set on my homepage. you can see it here: https://trucosyastucias.com/

    thaths the image https://trucosyastucias.com/wp-content/uploads/2019/06/trucos-y-astucias-tienda-online-artesanias-regalos.jpg

    should i put “Background-image” anyways??

    thanks

    #981214
    David
    Staff
    Customer Support

    Aah sorry my bad for not reading the topic….

    So you can create your own custom classes for that purpose:

    @media (max-width: 449px) {
        .custom-hide-mobile {
            display: none !important;
        }
    }
    @media (min-width: 450px) and (max-width: 799px) {
        .custom-hide-tablet {
            display: none !important; 
        }
    }
    @media (min-width: 800px) {
        .custom-hide-desktop {
            display: none !important;
        }
    }

    Now you can use custom-hide-mobile etc. in place of the GP included classes.

    #981743
    Patricia

    thank you David, that works perfectly!! <3

    #981837
    David
    Staff
    Customer Support

    Glad we could be of help

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