Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Apples
Bananas
Cherries
Oranges
css
* { border: 0; box-sizing: border-box; margin: 0; padding: 0; } :root { --bg: #e3e4e8; --checkBg: #ffffff; --checkBorder: #c7cad1; --fg: #17181c; --fgDim: #5c6270; --primary: #255ff4; --dur: 0.6s; font-size: calc(16px + (24 - 16) * (100vw - 320px) / (1280 - 320)); } body, input { color: var(--fg); font: 1em/1.5 system-ui, -apple-system, sans-serif; } body { display: grid; height: 100vh; place-items: center;background-color: #cceeff; } label, input[type=checkbox] { cursor: pointer; } label { display: inline-flex; align-items: center; margin-bottom: 0.75em; position: relative; -webkit-tap-highlight-color: transparent; } input[type=checkbox], input[type=checkbox]:before, input[type=checkbox]:after { width: 1.5rem; height: 1.5rem; } input[type=checkbox], input[type=checkbox]:before { background: var(--checkBg); border-radius: 0.2em; box-shadow: 0 0 0 1px var(--checkBorder) inset; } input[type=checkbox]:before, input[type=checkbox]:after { display: block; position: absolute; top: 0; left: 0; } input[type=checkbox] { margin-right: 0.75em; -webkit-appearance: none; appearance: none; } input[type=checkbox] + span { animation: brighten var(--dur) linear; } input[type=checkbox]:before { animation: unstrike var(--dur) linear; content: ""; transform-origin: 0 50%; z-index: 1; } input[type=checkbox]:after { color: var(--primary); content: "\2713"; font-size: 1.5em; line-height: 1; text-align: center; } input[type=checkbox]:focus { outline: transparent; } input[type=checkbox]:focus + span { text-decoration: underline; } input[type=checkbox]:checked + span { animation-name: dim; color: var(--fgDim); } input[type=checkbox]:checked:before { animation-name: strike; background: var(--fgDim); border-radius: 0; box-shadow: 0 0 0 1px var(--fgDim) inset; transform: translateX(2.25em) scale(1,0.05); width: calc(100% - 2.25em); } input[type=checkbox].pristine:before, input[type=checkbox].pristine + span { animation: none; } /* Dark mode */ @media (prefers-color-scheme: dark) { :root { --bg: #17181c; --checkBg: #2e3138; --checkBorder: #454954; --fg: #e3e4e8; --fgDim: #8f95a3; --primary: #5583f6; } } /* Animations */ @keyframes dim { from, 83% { color: var(--fg); } to { color: var(--fgDim); } } @keyframes brighten { from { color: var(--fgDim); } 17%, to { color: var(--fg); } } @keyframes unstrike { from { background: var(--fgDim); border-radius: 0; box-shadow: 0 0 0 1px var(--fgDim) inset; transform: translateX(2.25em) scale(1,0.05); width: calc(100% - 2.25em); } 14% { background: var(--fg); border-radius: 0; box-shadow: 0 0 0 1px var(--fg) inset; transform: translateX(2.25em) scale(1,0.05); width: calc(100% - 2.25em); } 29% { background: var(--fg); border-radius: 0; box-shadow: 0 0 0 1px var(--fg) inset; transform: translateX(2.75em) scale(1,0.05); width: calc(100% - 2.25em); } 43% { background: var(--fg); border-radius: 0; box-shadow: 0 0 0 1px var(--fg) inset; transform: translateX(-0.5em) scale(0.75,0.05); width: 1.5em; } 57% { background: var(--fg); border-radius: 0; box-shadow: 0 0 0 1px var(--fg) inset; transform: translateX(0) scale(1,0.05); width: 1.5em; } 71% { background: var(--fg); border-radius: 0.2em; box-shadow: 0 0 0 1px var(--fg) inset; transform: translateX(0) scale(1,1.25); width: 1.5em; } 86% { background: var(--fg); border-radius: 0.2em; box-shadow: 0 0 0 1px var(--fg) inset; transform: translateX(0) scale(1,1); width: 1.5em; } to { background: var(--checkBg); border-radius: 0.2em; box-shadow: 0 0 0 1px var(--checkBorder) inset; transform: translateX(0) scale(1,1); width: 1.5em; } } @keyframes strike { from { background: var(--checkBg); border-radius: 0.2em; box-shadow: 0 0 0 1px var(--checkBorder) inset; transform: translateX(0) scale(1,1); width: 1.5em; } 17% { background: var(--fg); border-radius: 0.2em; box-shadow: 0 0 0 1px var(--fg) inset; transform: translateX(0) scale(1,1); width: 1.5em; } 33% { background: var(--fg); border-radius: 0; box-shadow: 0 0 0 1px var(--fg) inset; transform: translateX(0) scale(1,0.05); width: 1.5em; } 50% { background: var(--fg); border-radius: 0; box-shadow: 0 0 0 1px var(--fg) inset; transform: translateX(-0.5em) scale(1,0.05); width: 1.5em; } 67% { background: var(--fg); border-radius: 0; box-shadow: 0 0 0 1px var(--fg) inset; transform: translateX(2.25em) scale(1.25,0.05); width: calc(100% - 2.25em); } 83% { background: var(--fg); border-radius: 0; box-shadow: 0 0 0 1px var(--fg) inset; transform: translateX(2.25em) scale(1,0.05); width: calc(100% - 2.25em); } to { background: var(--fgDim); border-radius: 0; box-shadow: 0 0 0 1px var(--fgDim) inset; transform: translateX(2.25em) scale(1,0.05); width: calc(100% - 2.25em); } }
JavaScript
document.addEventListener("DOMContentLoaded",function(){ this.forms[0].addEventListener("change",e => { e.target.removeAttribute("class"); }); });
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>自定checkbox复选框-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号