I am trying to set a background-image to stretch to the full extent of a
The syntax of (multiple) background shorthand is: background: [ Where ... If one So the in order to include Assuming that you want to crop the image from the center instead of top-left you would write: All four examples below use the same image:
background-size, you must specify the background-position before it and place a / in-between.
background: url(...) center / cover;
h1 {
font: medium monospace;
}
.test {
display: inline-block;
}
.test-landscape {
width: 200px;
height: 150px;
}
.test-portrait {
width: 150px;
height: 200px;
}
.test-lefttop {
background: url(http://dummyimage.com/400x400/CCC/000000&text=%C3%97) left top / cover;
}
.test-center {
background: url(http://dummyimage.com/400x400/CCC/000000&text=%C3%97) center / cover;
}background-position: left top
background-position: center