图像分层效果

html:

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title>fenCengImg</title>

        <link rel="stylesheet" type="text/css" href="../css/fenCengImg.css"/>

</head>

<body>

        <div class="container">

            <img src="../resource/img/niujinchun.jpg" >

            <img src="../resource/img/niujinchun.jpg" >

            <img src="../resource/img/niujinchun.jpg" >

            <img src="../resource/img/niujinchun.jpg" >

        </div>

</body>

</html>

css:

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(30deg) scale(.8);

    transition: 0.5s;

}

.container img{

    position: absolute;

    width: 100%;

    height: 100%;

    transition: 0.5s;

}

.container:hover img:nth-child(4){

    transform: translate(100px,-100px);

    opacity: 1;

}

.container:hover img:nth-child(3){

    transform: translate(80px,-80px);

    opacity: .8;

}

.container:hover img:nth-child(2){

    transform: translate(60px,-60px);

    opacity: .6;

}

.container:hover img:nth-child(1){

    transform: translate(40px,-40px);

    opacity: .4;

}

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 1、属性选择器:id选择器 # 通过id 来选择类名选择器 . 通过类名来选择属性选择器 ...
    Yuann阅读 1,737评论 0 7
  • 本书介绍 你是不是对Django的学习感到迷茫?是不是对网上零星的教程感到绝望?是不是苦于没有可以迅速上手的实例而...
    阡陌3536阅读 1,391评论 0 0
  • .face { left: 50%; top: 50%; position: absolute; width: 4...
    横冲直撞666阅读 636评论 1 0
  • Hello,好久不见,甚是想念! 一个月没有更新公众号,因为这一个月去追寻梦想了—体验了一把夜市摆摊生活。 摆了2...
    MisS作作阅读 257评论 0 0
  • 8月5-6日 数不清这是第几次看这本小说。初时读,只觉温衡可怜委屈柔弱但是内心强大铸成铜墙铁壁不让自己受伤。只觉作...
    城安依旧阅读 351评论 0 0

友情链接更多精彩内容