<div class="container">
<p>
Change the values of the <code>background-size</code> property on both elements to see how the background image will be sized differently:
</p>
<div class="element element-1"></div>
<div class="element element-2"></div>
</div>
* {
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
background-color: #F5F5F5;
color: #555;
font-size: 1.1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.container {
width: 90%;
margin: 30px auto;
}
.element {
padding: 20px;
margin: 30px 0;
color: white;
height: 400px;
border: 5px solid black;
background-repeat: no-repeat;
}
.element-1 {
background-image: url(http://tympanus.net/codrops-playground/assets/images/cssref/properties/background-size/stationary2.jpg);
background-size: auto 100%;
}
.element-2 {
/* IE <= 9 */
background-image: filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#ee71a9', endColorstr='#006699', GradientType=1);
background-image: -webkit-linear-gradient(to bottom, #ee71a9, #006699);
background-image: linear-gradient(to bottom, #ee71a9, #006699);
background-size: 400px 300px;
}