实现动态堆叠卡的效果

哈喽,小伙们!今晚我来给大家分享一个关于实现动态堆叠卡的效果,来源于一本名为Div+CSS3+jQuery 网页设计深度剖析的书。这里面也包括我对旋转角度进行的改动,让它看起来更自然。如果大家有更好的建议,欢迎在下方给我留言!                                                                              

HTML部分 


<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>动态堆叠卡</title>
        <link rel="stylesheet" type="text/css" href="css/index.css"/>
    </head>
    <body>
        <div id="card">
            <ul>
                <li id="one"><img src="img/one.jpg" width="130" height="130"/></li>
                <li id="two"><img src="img/one.jpg" width="130" height="130"/></li>
                <li id="three"><img src="img/one.jpg" width="130" height="130"/></li>
                <li id="four"><img src="img/one.jpg" width="130" height="130"/></li>
                <li id="five"><img src="img/one.jpg" width="130" height="130"/></li>
            </ul>
        </div>
    </body>
</html>

CSS部分 


@charset "UTF-8";
*{
    margin: 0;
    padding: 0;
    text-decoration: none;
}

#card li{
    display: block;
    position: relative;
    list-style-type: none;
    width: 130px;
    height: 350px;
    background-color: #963;
    border: 2px dashed #FF6600;
    padding: 25px 9px;
    margin-bottom: 60px;
    float: left;
    border-radius:10px;
    -moz-border-radius:10px;
    -webkit-border-radius:10px;
    box-shadow: 2px 2px 10px #000;
    -moz-box-shadow: 2px 2px 10px #000;
    -webkit-box-shadow: 2px 2px 10px #000;
    transition: all 0.5s ease-in-out;
    -moz-transition: all 0.5s ease-in-out; 
    -webkit-transition: all 0.5s ease-in-out;
}

/*#card h3{
    font-size: 24px;
    font-weight: bold;
    color: #FFF;
    line-height: 40px;    
}

#card p{
    margin-top: 20px;
    text-align: left;
    color: #FFF;
    
}*/

#card img{
    margin-top: 20px;
    background-color: #FFF;
    border-radius:6px;
    -moz-border-radius:6px;
    -webkit-border-radius:6px;
    box-shadow: 0px 0px 5px #666;
    -moz-box-shadow: 0px 0px 5px #666;
    -webkit-box-shadow: 0px 0px 5px #666;
}

#one{
    z-index: 1;
    left: 150px;
    top: 40px;
    transform: rotate(-20deg);
    -moz-transform: rotate(-20deg);
    -webkit-transform: rotate(-20deg);
}

#two{
    z-index: 2;
    left: 70px;
    top: 10px;
    transform: rotate(-10deg);
    -moz-transform: rotate(-10deg);
    -webkit-transform: rotate(-10deg);
}

#three{
    z-index: 3;
    background-color: #963;
}

#four{
    z-index: 2;
    right: 70px;
    top: 10px;
    transform: rotate(10deg);
    -moz-transform: rotate(10deg);
    -webkit-transform: rotate(10deg);
}

#five{
    z-index: 1;
    right: 150px;
    top: 40px;
    transform: rotate(20deg);
    -moz-transform: rotate(20deg);
    -webkit-transform: rotate(20deg);
}

#one:hover{
    z-index: 4;
    transform: scale(1.1) rotate(-20deg);
    -moz-transform: scale(1.1) rotate(-20deg);
    -webkit-transform: scale(1.1) rotate(-20deg);
}

#two:hover{
    z-index: 4;
    transform: scale(1.1) rotate(-20deg);
    -moz-transform: scale(1.1) rotate(-20deg);
    -webkit-transform: scale(1.1) rotate(-20deg);
}

#three:hover{
    z-index: 4;
    transform: scale(1.1) rotate(-20deg);
    -moz-transform: scale(1.1) rotate(-20deg);
    -webkit-transform: scale(1.1) rotate(-20deg); 
}

#four:hover{
    z-index: 4;
    transform: scale(1.1) rotate(20deg);
    -moz-transform: scale(1.1) rotate(20deg);
    -webkit-transform: scale(1.1) rotate(20deg);

}

#five:hover{
    z-index: 4;
    transform: scale(3.1) rotate(20deg);
    -moz-transform: scale(1.1) rotate(20deg);
    -webkit-transform: scale(1.1) rotate(20deg);

}

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值