试着用CSS3实现加载中(loading)等待按钮状态,一起来看下源码,学习哦。
<!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>Document</title>
    <style>
        button {
            opacity: 0.5;
            cursor: default;
            pointer-events: none;
        }
        button:before {
            content: '';
            display: inline-block;
            width: 1em;
            height: 1em;
            margin-right: 0.5em;
            color: red;
            border: 1px solid red;
            border-radius: 50%;
            vertical-align: -10%;
            clip-path: polygon(0% 0%, 100% 0%, 100% 30%, 0% 30%);
            animation: rotate 1s linear infinite;
        }
        @keyframes rotate {
            from {
                transform: rotatez(0deg);
            }
            to {
                transform: rotatez(360deg);
            }
        }
    </style>
</head>
<body>
    <button>css-loading</button>
</body>
</html>    




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