We would like to know how to use Image as background of div.
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.img-box {<!--from ww w . j a v a2s.co m-->
position: relative;
border: solid 2px red;
width: 280px;
height: 250px;
overflow: hidden;
}
.img-box>img {
position: absolute;
left: -10px;
top: -10px;
}
</style>
</head>
<body>
<div class="img-box">
<img src="http://www.java2s.com/style/download.png"
alt="" />
</div>
</body>
</html>
The code above is rendered as follows: