<div class="button center">
<input id="checkbox" type="checkbox">
<div class="button-center center">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="currentColor"><path fill-rule="evenodd" d="M9.25 18.709c0-.42.336-.76.75-.76h4c.414 0 .75.34.75.76s-.336.76-.75.76h-4a.755.755 0 0 1-.75-.76Zm.667 2.532c0-.42.335-.76.75-.76h2.666c.415 0 .75.34.75.76a.754.754 0 0 1-.75.759h-2.666a.755.755 0 0 1-.75-.76Z" clip-rule="evenodd"/><path d="m7.41 13.828l1.105 1.053c.31.295.485.707.485 1.137c0 .647.518 1.172 1.157 1.172h3.686c.639 0 1.157-.525 1.157-1.172c0-.43.176-.842.485-1.137l1.104-1.053c1.542-1.48 2.402-3.425 2.41-5.446L19 8.297C19 4.842 15.866 2 12 2S5 4.842 5 8.297v.085c.009 2.021.87 3.966 2.41 5.446Z"/></g></svg>
</div>
</div>
HTML
格式化
支持Emmet,输入 p 后按 Tab键试试吧!
<head> ... </head>
<body>
</body>
CSS
格式化
.button {
width: 200px;
height: 200px;
background:linear-gradient(130deg, #646265, #101010);
box-shadow:
-2px -2px 1px 3px #1b1b1b,
2px 2px 1px 2px #686868,
-12px -12px 15px #605e61,
12px 12px 15px #1b1b1b
;
border-radius: 50%;
transition: .2s ease;
}
.button-center {
width: 80px;
height: 80px;
background:linear-gradient(130deg, #646265, #101010);
box-shadow:
0px 0px 5px 5px #323232,
5px 4px 5px 1px #9b999c,
-5px -5px 10px 5px #1b1b1b
;
border: 3px solid #2d2d2d;
border-radius: 50%;
font-size: 42px;
color: #9b999c;
transition: .7s ease;
}
.button:active {
box-shadow:
-0px -0px 1px 3px #1b1b1b,
0px 0px 1px 2px #686868,
-3px -3px 15px #605e61,
3px 3px 15px #1b1b1b
;
}
.center {
display: flex;
justify-content: center;
align-items: center;
}
input {
position: absolute;
width: 200px;
height: 200px;
border-radius: 50%;
opacity: 0;
cursor: pointer;
}
input:active, input:focus {
background: transparent;
box-shadow: none;
outline: none;
outline-width: 0;
-webkit-tap-highlight-color: rgba(0,0,0,0) !important;
}
input[type=checkbox]:checked ~ .button-center {
color: #49fb35;
box-shadow:
0px 0px 10px 2px #49fb35,
0px 0px 5px 5px #323232,
5px 4px 5px 1px #9b999c,
-5px -5px 10px 5px #1b1b1b
;
}
body {
width: 100%;
height: 100vh;
background:linear-gradient(120deg, #413f42, #2d2d2d);
display: flex;
justify-content: center;
align-items: center;
}
JS
格式化