background image for div css code example
Example 1: div background image
#avatar {
background-image: url('http://i.stack.imgur.com/Dj7eP.jpg');
width: 150px;
height: 150px;
background-size: cover;
background-position: top center;
border-radius: 50%;
}
Example 2: How to set a image as a backgroung image
<style>
body {
background-image: url('img_girl.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
</style>
Example 3: how to set div background image
body {
background-image: url("paper.gif");
background-color: #cccccc;
}