- This topic has 20 replies, 3 voices, and was last updated 2 years, 2 months ago by Ying.
-
AuthorPosts
-
March 5, 2022 at 10:58 am #2143663metcomllc@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
March 5, 2022 at 11:11 am #2143683LeoStaffCustomer SupportHi 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/ky2CZDolNiCKMore info here:
https://developer.mozilla.org/en-US/docs/Web/CSS/background-size
https://developer.mozilla.org/en-US/docs/Web/CSS/background-positionMarch 5, 2022 at 11:25 am #2143709metcomllc@aol.comThat 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?
March 5, 2022 at 11:29 am #2143714LeoStaffCustomer SupportIs 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) } }
March 5, 2022 at 11:40 am #2143734metcomllc@aol.comDid 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) } }
March 5, 2022 at 11:43 am #2143738LeoStaffCustomer SupportCan you clear and disable any caching plugins or server caching you are using including SG optimizer?
March 5, 2022 at 11:53 am #2143744metcomllc@aol.comYes, everything is disabled.
March 5, 2022 at 12:03 pm #2143751LeoStaffCustomer SupportAnd it’s working?
https://www.screencast.com/t/4xhZUzsIFdlMarch 5, 2022 at 12:05 pm #2143753metcomllc@aol.comNo. It looks exactly the same.
March 5, 2022 at 12:06 pm #2143754metcomllc@aol.comThat 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/ky2CZDolNiCKMarch 5, 2022 at 12:08 pm #2143755LeoStaffCustomer SupportHmm 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-2143734March 5, 2022 at 12:50 pm #2143773metcomllc@aol.comI 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.
March 5, 2022 at 1:42 pm #2143804LeoStaffCustomer SupportCan you share the current code you are using here?
March 5, 2022 at 2:18 pm #2143816metcomllc@aol.comCode?
March 5, 2022 at 2:38 pm #2143828LeoStaffCustomer SupportYes – this is the active code I see:
https://generatepress.com/forums/topic/background-image-11/#post-2143734Have you modified the URL yet?
-
AuthorPosts
- You must be logged in to reply to this topic.