CSS - centering the image
So, I have an image that works as a background, and it "scales to fill" the frame, which is exactly how I want it, but the image is not centered, and so when the window is smaller, like on a phone, the displayed image is it's just the edge. Here is the code I used:
Html
<div class="Background">
<div>
CSS
.Background {
display: block;
margin-left: auto;
margin-right: auto;
width: 100vw;
height: 100vh;
background-image: url('background.png');
background-size: cover;
}
If anyone could give me some hints then that would be great. Thanks to
+3
source to share
4 answers