Page 1 of 1

background image

Posted: Sun Sep 18, 2016 2:25 pm
by Terry Gilliver

I have added a background image to my page using the following css:

pre
.wallpaper {
background-image: url("../img/bg.png");
background-repeat: no-repeat;
background-size: cover;
}
/pre

The resultant background has a white bar on the left which I cannot account for. It is definitely not in the original image:

Image


background image

Posted: Sun Sep 18, 2016 2:33 pm
by Terry Gilliver

Sorted.

Adding background-position: center; fixed the problem.


background image

Posted: Sun Sep 18, 2016 6:39 pm
by Bruce Stuart

thanks for updating the topic... I was looking for the same solution Terry :-)


background image

Posted: Fri Sep 23, 2016 9:46 am
by Terry Gilliver

I did find on examination of my image in fireworks, that it had a transparent bar down each side, which accounted for the 'white' bar on the left. just something to look out for as most image viewers won't show this as transparencies will allow the background to "show through".