I created a slide in my WordPress site and I want the background of the slide to be background-size: cover
on desktop and background-size: contain
on mobile. I tried to achieve that by using media queries like so:
@media screen and (min-width: 320px) and (max-width: 675px) {
.tp-bgimg {
background-color: rgb(6, 6, 6) !important;
background-size: contain !important;
}
}
But there is a time gap between the load of the slide and until the media query takes place, so i first see the background as cover
and after a sec or two it changes to contain
, any idea how can i solve this issue?
thx
A better solution for what you need to do is:
With this configuration you should see the image fitting in any screen size.