×

CSS3:实现三维空间的叠加效果

作者:ceshi2018.12.28来源:Web前端之家浏览:750评论:0
关键词:CSS3叠加
微信公众号

微信公众号

晚上闲着没事,看到了一个不错的效果,用CSS3实现三维空间的叠加效果,分享出来给大家,一起学习下。先看下效果图:

图片.png

接下来,直接贴上代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>CSS3实现3D叠层效果</title>
    <style>
        body{
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .container{
            position: relative;
            width: 360px;
            height: 640px;
            background: rgba(0,0,0,.1);
            transform: rotate(-30deg) skew(25deg) scale(.7);
            transition:.3s;
        }

        .container img{
            position: absolute;
            width: 100%;
            transition: .5s;
        }

        .container:hover img:nth-child(4){
            transform: translate(160px,-160px);
            opacity: 1;
        }

        .container:hover img:nth-child(3){
            transform: translate(120px,-120px);
            opacity: .8;
        }

        .container:hover img:nth-child(2){
            transform: translate(80px,-80px);
            opacity: .5;
        }
        .container:hover img:nth-child(1){
            opacity: .4;
            transform: translate(40px,-40px);
        }

    </style>
</head>
<body>
    <div class="container">
        <img src="https://123p1.sogoucdn.com/imgu/2018/12/20181211151344_369.jpg" >
      <img src="https://123p1.sogoucdn.com/imgu/2018/12/20181211151344_369.jpg" >
      <img src="https://123p1.sogoucdn.com/imgu/2018/12/20181211151344_369.jpg" >
      <img src="https://123p1.sogoucdn.com/imgu/2018/12/20181211151344_369.jpg" >
    </div>
</body>
</html>

OK,大家去看下代码吧,是不是很牛逼,学到了吧。

温馨提示:本文作者系 ,经Web前端之家编辑修改或补充,转载请注明出处和本文链接:
https://www.jiangweishan.com/article/css2324234643634.html

网友评论文明上网理性发言 已有0人参与

发表评论:

最新留言

  • 菜鸟日记

    有点东西。来学习一下~...

  • 码云笔记

    你好,前端博客-www.mybj123.com申请友链,有兴趣请联系QQ3261229068...

  • admin

    是的,新版也是不错的。...

  • Qanmy

    火狐56版本最经典。。。...

  • 前端大爆炸

    交换一下链接前端大爆炸!-WEBBANG!BANG!!BANG!!!https://a...

  • Wreb

    加群讨论...

  • 访客

    非常感谢...

  • 访客

    那如果自定义转发的图片未生成完,他给我转发的是默认截屏怎么办...

首页|JavaScript|HTML|HTML4|HTML5|CSS3|开发工具|性能优化|移动开发|前端教程|性能优化|开发工具|酷站欣赏|UI设计|前端教程

Copyright © 2013-2018 Web前端之家(www.jiangweishan.com) 版权所有 All Rights Reserved.
粤ICP备12067512号-1

Copyright Your WebSite.Some Rights Reserved.

Powered By Z-BlogPHP 1.5.2 Zero