其他分享
首页 > 其他分享> > 骨架屏

骨架屏

作者:互联网

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>骨架屏</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        :root {
            --loading-grey: #ededed;
        }

        body {
            background-color: #f6f6f6;
            font-family: Helvetica;
            font-size: 15px;
            display: flex;
            justify-content: space-evenly;
            align-items: center;
            min-height: 100vh;
        }

        .card {
            width: 320px;
            background-color: #fff;
            border-radius: 6px;
            overflow: hidden;
            box-shadow: 0px 4px 6px rgba(0, 0, 0, .12);
        }

        .image {
            height: 200px;
        }

        .image img {
            display: block;
            width: 100%;
            height: inherit;
            /* object-fit: cover; */
        }

        .content {
            padding: 2rem 1.8rem;
        }

        h4 {
            margin: 0 0 1rem;
            font-size: 1.5rem;
            line-height: 1.5rem;
        }

        .description {
            font-size: 1rem;
            line-height: 1.4rem;
        }

        .loading .image,
        .loading h4,
        .loading .description {
            background: linear-gradient(100deg,
                    rgba(255, 255, 255, 0) 40%,
                    rgba(255, 255, 255, .5) 50%,
                    rgba(255, 255, 255, 0) 60%) var(--loading-grey);
            background-size: 200% 100%;
            background-position-x: 180%;
            animation: 1s loading ease-in-out infinite;
        }

        @keyframes loading {
            to {
                background-position-x: -20%;
            }
        }

        .loading h4 {
            min-height: 1.6rem;
            border-radius: 4px;
            animation-delay: .04s;
        }

        .loading .description {
            min-height: 4rem;
            border-radius: 4px;
            animation-delay: .06s;
        }
    </style>
</head>

<body>
    <div class="card">
        <div class="image">
            <img src="https://assets.codepen.io/2002878/wake-up-and-code.jpg" alt="">
        </div>
        <div class="content">
            <h4>CodingStartup</h4>
            <div class="description">
                Lorem, ipsum dolor sit amet consectetur adipisicing elit. Molestias labore, qui beatae incidunt
                explicabo magnam fuga facere doloribus.
            </div>
        </div>
    </div>
    <div class="card loading">
        <div class="image">

        </div>
        <div class="content">
            <h4></h4>
            <div class="description">

            </div>
        </div>
    </div>
</body>

</html>

标签:loading,骨架,height,background,rem,font,255
来源: https://www.cnblogs.com/letgofishing/p/16204253.html