图片选择倒影效果

代码语言:html

所属分类:视觉差异

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <title> image selector with reflection</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            position: relative;
            width: 100%;
            height: 90vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: #F5F5F5;
        }

        .images-selector input {
            position: absolute;
            z-index: 10;
        }

        .images-selector input:checked + .img-card {
            filter: none;
            transform: scaleY(1);
        }

        .img-card {
            display: inline-block;
            width: 250px;
            height: 200px;
            background-size: contain;
            background-repeat: no-repeat;
            cursor: pointer;
            transition: all 200ms ease-in;
            filter: grayscale(1) opacity(.8);
        }

        .img-card:hover {
            filter: grayscale(0) opacity(1);
            /*   box-shadow:  0px 8px 4px rgba(0, 0, 0, 0.3),
               0px 10px 2px rgba(0, 0, 0, 0.1); */
        }

        .img-card::before,
        .img-card::after {
            transform: scaleY(-1);
        }

        /*reflection*/
        .img-card:hover::after {
            content: '';
            background-image: inherit;
            background-repeat: no-repeat;
            background-position: bottom;
            background-size: cover;
            width: inherit;
            height: 40%;
            position: absolute;
            bottom: -25%;
        }

        /*fade re.........完整代码请登录后点击上方下载按钮下载查看

网友评论0