I'm having issues with re-sizing my background image in CSS to fit other smaller screens than the intended screen size of my laptop
I have already tried 'background-size: contain' and 'background-repeat : no-repeat'. still, the background image blew out of proportion. I have a set of parameters for the image, which is 'height: 100vh;'
/* with this, only a fraction of image is seen in phone */
header {
background - image: -webkit - linear - gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url(img / hero.jpg);
background - image: linear - gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url(img / hero.jpg);
background - size: cover;
height: 100 vh;
background - position: center;
background - repeat: no - repeat;
background - attachment: fixed;
}
/* with this a grey background appears in phone screens */
header {
background - image: -webkit - linear - gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url(img / hero.jpg);
background - image: linear - gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url(img / hero.jpg);
background - size: contain;
height: 100 vh;
background - position: center;
background - repeat: no - repeat;
background - attachment: fixed;
}
I expect the image to fit all screen sizes without zooming in and blurring, but the results always blew out of proportion.