码迷,mamicode.com
首页 > 移动开发 > 详细

css3实现小米商城鼠标移动图片上浮阴影效果

时间:2016-11-11 23:22:30      阅读:408      评论:0      收藏:0      [点我收藏+]

标签:chrome   color   :hover   png   nts   device   html   neu   src   

今天在编程爱好者编码库看见一个好玩的程序,代码如下。

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit">
 
    <title>CSS3实现小米商城鼠标移动图片上浮阴影效果</title>
    <style>
        *{margin: 0;padding: 0;font-family: ‘微软雅黑‘,‘Helvetica Neue‘, Arial, sans-serif}
        body{
            background-color: #f5f5f5;
            text-align: center;
        }
 
        .image-shadow{
            position:relative/*设置为相对*/
            margin: 60px auto;
            z-index: 1;
            width: 294px;
            height: 413px;
            background: #fff;
            -webkit-transition: all .2s linear; /*渐变效果*/
            transition: all .2s linear;
        }
         
        .image-shadow:hover{
            z-index: 2; /*设置在顶层显示*/
            -webkit-box-shadow: 0 15px 30px rgba(0,0,0,0.1);    /*添加阴影*/
            box-shadow: 0 15px 30px rgba(0,0,0,0.1);
            -webkit-transform: translate3d(0, -2px, 0);     /*向上浮动*/
            transform: translate3d(0, -2px, 0);
        }
         
    </style>
</head>
<body>
 
<h3 style="margin: 60px 0 20px 0; text-align: center">CSS3实现小米商城鼠标移动图片上浮阴影效果</h3>
 
<div class="image-shadow">
</div>
 
</body>
</html>

css3实现小米商城鼠标移动图片上浮阴影效果

标签:chrome   color   :hover   png   nts   device   html   neu   src   

原文地址:http://www.cnblogs.com/future-zmy/p/6055808.html

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