Site logo

Archived topic

Custom Mobile Backround Image

5 replies · Started by Matt Stern on September 16, 2021

Viewing posts 1–6 of 6

Hi there,

I have a container with a background image set to "Full." Is it possible to set the same image to "Contain" on mobile?

Thank you!

Matt

Hi Matt,

Do you mean cover when you say full?

Depends on if you are using pseudo element, you can add CSS to change the background-size to contain.

Eg.

@media (max-width: 768px) {
.block {
    background-size: contain;
}
}

or

@media (max-width: 768px) {
.block:before {
    background-size: contain;
}
}

Let me know if you need further assistance :)

Oh, yes I meant "Cover"

So if I change it to Pseudo Element, I can use the css provided? Does ".block" apply to all blocks?

It’s just a general example.

You’ll need to switch the .blockwith the actual block ID, otherwise you won’t be able to override the original CSS.

And the CSS with:afteris for pseudo element background.

Thanks, Ying, that worked.

Glad to hear that :)

This archived topic is closed to new replies.