I have a div with a background image with background-size: cover. Is that possible to vertically align the background image on center?
I tried background-position: left center e background-position: 0 50%
here is a fiddle http://jsfiddle.net/V8X2V/
EDIT:
Indeed background-position: left center; works! my problem was that I had a inline style for background, and was trying to add the background-position in a css file, for some reason it wouldn't work. But when I did put the position inline, it worked...
You can use background-position. Something like this :
div {
background: url(http://placekitten.com/400/400);
background-size: cover;
width: 300px;
height: 150px;
background-position: 0% 30%;
}
DEMO : JSFIDDLE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With