[Resolved] Background Image

Home Forums Support [Resolved] Background Image

Home Forums Support Background Image

Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #2143663
    metcomllc@aol.com

    I have a container block with a background image on my main page. On mobile the image doesn’t resize and just looks too zoomed in. https://magicalearthretreat.com

    #2143683
    Leo
    Staff
    Customer Support

    Hi there,

    Background images aren’t responsive by nature so there isn’t anything we can do here.

    The only improvement I can think of is to change the size and position on mobile:
    https://www.screencast.com/t/ky2CZDolNiCK

    More info here:
    https://developer.mozilla.org/en-US/docs/Web/CSS/background-size
    https://developer.mozilla.org/en-US/docs/Web/CSS/background-position

    #2143709
    metcomllc@aol.com

    That helped but I thought you might be able to provide CSS like this specific to my site:

    Hi Lunatrix,

    Try this CSS:

    @media (max-width: 768px) {
        .gb-container-2dc097b2:before {
            background-size: 1000px;
            background-position: left bottom;
        }
    }

    Is it possible to have a different background image for mobile? If yes, how?

    #2143714
    Leo
    Staff
    Customer Support

    Is it possible to have a different background image for mobile? If yes, how?

    Here you go:

    @media (max-width: 768px) {
        .gb-container.gb-container-d038e518:before {
            background-image: url(https://URL-HERE)
        }
    }
    #2143734
    metcomllc@aol.com

    Did I do this right? I ask because I do not see a difference.

    @media (max-width: 768px) {
        .gb-container.gb-container-d038e518:before {
            background-image: url(https://magicalearthretreat.com/wp-content/uploads/2022/03/stock-photo-the-vintage-little-yellow-home-with-blue-door-on-the-green-lawn-in-the-beautiful-garden-hobbit-1106877812.jpg)
        }
    }
    #2143738
    Leo
    Staff
    Customer Support

    Can you clear and disable any caching plugins or server caching you are using including SG optimizer?

    #2143744
    metcomllc@aol.com

    Yes, everything is disabled.

    #2143751
    Leo
    Staff
    Customer Support
    #2143753
    metcomllc@aol.com

    No. It looks exactly the same.

    #2143754
    metcomllc@aol.com

    That is how it looked after make this change

    The only improvement I can think of is to change the size and position on mobile:
    https://www.screencast.com/t/ky2CZDolNiCK

    #2143755
    Leo
    Staff
    Customer Support

    Hmm looks like you are using the exact same image twice?

    The URL here needs to be a mobile-specific image:
    https://generatepress.com/forums/topic/background-image-11/#post-2143734

    #2143773
    metcomllc@aol.com

    I am using a unique image now but for some reason the original image keeps showing up. I have cleared all the caches and browsing history several times.

    #2143804
    Leo
    Staff
    Customer Support

    Can you share the current code you are using here?

    #2143816
    metcomllc@aol.com

    Code?

    #2143828
    Leo
    Staff
    Customer Support

    Yes – this is the active code I see:
    https://generatepress.com/forums/topic/background-image-11/#post-2143734

    Have you modified the URL yet?

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