- This topic has 24 replies, 3 voices, and was last updated 4 years, 2 months ago by
David.
-
AuthorPosts
-
December 14, 2021 at 1:24 am #2048357
Eloy
Hello!
I need the page header image on mobile to adapt to the screen size but neither this
@media (max-width: 768px) {
.generate-content-header {
background-size: 100% auto;
}
}nor this
@media (max-width: 768px) {
.page-hero {
background-size: 100% auto;
}
}works
I“m using Access theme and this is the test website
December 14, 2021 at 2:39 am #2048451David
StaffCustomer SupportHi there,
the image is the background to the first container block in the page.
And changing its background-size is going to cause you other problems with that design ie. the Image won’t fill the container leaving a lot of white space.To see that trying adding this CSS:
@media(max-width: 768px) { .gb-container-e6fb72d9:before { background-size: 100% auto; } }December 14, 2021 at 4:47 am #2048578Eloy
Mmm, I see… thank you for your help š
Nothing to do then? There is no way to scale the image according to screen size?
Thanks again š
December 14, 2021 at 5:48 am #2048639David
StaffCustomer SupportWithout distorting the image – no.
You need to consider either:a) Changing the background image for Mobile.
OR
b) adjusting the Content inside that Container block so it keeps the Landscape aspect ratio on mobile. Such as reducing font sizes or padding.
December 14, 2021 at 6:53 am #2048716Eloy
Thank you.
I“d have to change the background image of the container inside the home page in the mobile section, right?
December 14, 2021 at 8:02 am #2048953David
StaffCustomer SupportThats correct.
If you have GenerateBlocks Pro you can do that with the Advance Backgrounds:
https://docs.generateblocks.com/article/advanced-backgrounds/
If you don have GB Pro then it will take some CSS. Let me know
December 15, 2021 at 1:32 am #2049554Eloy
Thanks.
I don“t have GB Pro.
December 15, 2021 at 3:56 am #2049679David
StaffCustomer SupportOK:
1. Select the Container Block that has the background image.
1.1 In the sidebar Advanced > Additional CSS Class(es) field add:home-hero-imagePublish those changes.
2. Add the following CSS to your site:
@media(max-width: 768px) { .gb-container.home-hero-image:before { background-image: url('the_full_url_to_your_mobile_image/image.jpg'); } }Update the background-image url to that of your mobile image.
December 15, 2021 at 5:11 am #2049770Eloy
Weird,
is not working…
@media(max-width: 768px) {
.gb-container.home-hero-image:before {
background-image: url(‘http://whynotpilates.recetamaestra.com/wp-content/uploads/2021/12/imagen-cabecera-why-not-pilates-manuel-alcazar-5-5-movil.jpg’);
}
}And -> https://imgur.com/a/orPa9Bs
December 15, 2021 at 5:15 am #2049773David
StaffCustomer SupportCheck it in the Front End of the site – that CSS won’t apply to the editor unless we add some code to apply it inside the editor.
December 15, 2021 at 5:20 am #2049782Eloy
I do not understand. That CSS is in additional css section in appearance / customize
January 19, 2022 at 9:38 am #2086214Eloy
Hi, again.
So is there any way to do it? I didn“t understand the last answer.
January 19, 2022 at 10:40 am #2086286Ying
StaffCustomer SupportSo is there any way to do it? I didn“t understand the last answer.
How’s the front end look like?
The CSS you added won’t show the effect in the page editor, but it should show in front end.
January 20, 2022 at 1:49 am #2086899Eloy
The front end looks the same, no changes.
You can check it http://whynotpilates.recetamaestra.com/
January 20, 2022 at 3:40 am #2087003David
StaffCustomer SupportCan you move that CSS to the very top of all your CSS in Customizer > Additional CSS.
One thing to note – i looked at the Mobile Image and apart from it being smaller it looks like the same image as the Desktop one…. which means your won’t notice any difference in its positioning….
-
AuthorPosts
- You must be logged in to reply to this topic.