1. 程式人生 > >css3中的content字圖片處理background

css3中的content字圖片處理background

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#div1{
width: 100px;height: 30px;
background: #ccc;position: relative;
}
#div1:after{position: absolute;right: -40px;font-size: 20px;
background: red;
content: '\2748';
}
#div2{position: relative;width: 100px;height: 20px;
background: pink;}
#div2:before{content: "";width: 20px;height: 20px;
background: url(eye_close.png)no-repeat;
display: block;
background-size: 100%;
position: absolute;left: 50px;
}
#div2:after{display: inline-block;
width: 20px;height: 20px;
position: absolute;
background: red;right: -20px;
content: url(eye_close.png);
background-size:80px ;    
}
</style>
</head>
<body>
<div id="div1">1111</div>
<div id="div2">2222</div>
</body>
</html>