码迷,mamicode.com
首页 > 其他好文 > 详细

视差效果原理 background-attachment:fixed

时间:2016-10-13 17:11:43      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:

<html>
<head>
<style type="text/css">
body
{ 
  background-image:url(‘http://images2015.cnblogs.com/blog/441096/201610/441096-20161013163910781-1393436376.jpg‘);
  background-repeat:no-repeat;
  background-attachment:fixed;
  background-position:center;
}
</style>
</head>

<body>
<body>


<div style="width:100px;height:100px;background:red;position:absolute;top:100px;left:100px">
</div>

<div style="width:100px;height:100px;background:blue;position:absolute;top:300px;left:300px">
</div>


<div style="width:100px;height:100px;background:white;position:absolute;top:600px;left:600px">
</div>

<div style="width:100px;height:100px;background:gray;position:absolute;top:900px;left:900px">
</div>

<div style="width:100px;height:100px;background:black;position:absolute;top:1200px;left:1200px">
</div>

</body>
</body>
</html>

 

视差效果原理 background-attachment:fixed

标签:

原文地址:http://www.cnblogs.com/hellowzd/p/5957018.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!