I have a container div:
<div id="fullpage" class="fullpage_bg">
...rest of the elements
</div
It has a background image for portrait and landscape:
#fullpage {background-color: rgba(0,0,0,0.2); background-position: center center;}
@media screen and (orientation:portrait) {
.fullpage_bg{
background-image: url('images/bg_portrait.jpg');
}
}
@media screen and (orientation:landscape) {
.fullpage_bg{
background-image: url('images/bg_landscape.jpg');
}
}
Is there a way to scale the image proportionally, either by using CSS or pure JS (no jQuery), for different screen sizes? For example: for landscape the image might take the entire height of the screen, but still have some margins on the sides (because the image must maintain proportions, but still fill the screen as much as possible). In portrait it might take the entire width, but have some margins on top and bottom. Thanks!