视觉艺术页面特效

CSS+HTML<3D按钮效果>

2019-11-27  本文已影响0人  誰在花里胡哨
效果图:
button.gif
代码如下:
<!DOCTYPE html>
<html lang="en">

<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>
        body,
        html {
            height: 100%;
        }

        body {
            width: 100%;
            margin: 0;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .button {
            user-select: none;
            cursor: pointer;
            width: 150px;
            height: 60px;
            margin: 0 auto;
            border: 1px solid #cfcfcf;
            border-radius: 30px;
            background: linear-gradient(to top, #D8D9DB 0%, #fff 80%, #FDFDFD 100%);
            box-shadow: 0 4px 3px 1px #FCFCFC, 0 6px 8px #D6D7D9, 0 -4px 4px #CECFD1, 0 -6px 4px #FEFEFE, inset 0 0 3px 0 #CECFD1;
        }

        .button span {
            color: #808080;
            display: inline-block;
            border-radius: 30px;
            width: 100%;
            height: 100%;
            overflow: hidden;
            display: flex;
            justify-content: center;
            align-items: center;
            transition: 0.3s;
            box-sizing: border-box;
            font-weight: bold;
        }

        .button:hover span {
            box-shadow: 0 0 5px 2px #CECFD1 inset;
            font-size: 15px;
        }

        .button:active span {
            box-shadow: 0 0 20px 5px #CECFD1 inset;
            font-size: 14px;
            animation: none;
        }
    </style>
</head>

<body>
    <div class="button" role="button">
        <span>BUTTON</span>
    </div>
</body>

</html>
上一篇 下一篇

猜你喜欢

热点阅读