border 转转转

2024-06-24  本文已影响0人  xueyueshuai
image.png
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        body {
            background: #000;
        }

        .btn {
            width: 200px;
            height: 100px;
            margin: 50px auto;
            color: #fff;
            background: #274593;
            outline: 0;
            border: none;
            position: relative;
            z-index: 0;
            overflow: hidden;
            border-radius: 4px;

            display: flex;
            justify-content: center;
            align-items: center;
        }

        .btn::before{
            content: '';
            display: block;
            position: absolute;
            left: 50%;
            top: 50%;
            width: 200%;
            height: 200%;
            background: red;
            z-index: -2;
            transform-origin: left top;
            animation: zhuan 3s linear infinite;
        }
        .btn::after{
            content: '';
            display: block;
            position: absolute;
            top: 2px;
            right: 2px;
            bottom: 2px;
            left: 2px;
            background: #000;
            z-index: -1;
            border-radius: inherit;
        }

        @keyframes zhuan {
            to{
                transform: rotate(360deg);
            }
        }
    </style>
</head>
<body>
<div class="btn">我是文字</div>
</body>
</html>


上一篇 下一篇

猜你喜欢

热点阅读