前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >css写一个原生switch开关按钮

css写一个原生switch开关按钮

作者头像
马克社区
发布2022-07-26 15:45:43
9170
发布2022-07-26 15:45:43
举报
文章被收录于专栏:高端IT
在这里插入图片描述
在这里插入图片描述
代码语言:javascript
复制
<!DOCTYPE html>
<html>
<head>
    <title>switch开关按钮</title>
    <style type="text/css">
#checked {
 width: 60px;
 position: relative;
 margin: 20px auto;
}
.labelBox {
 margin-bottom: 20px;
 background: #409eff;
 border-radius: 40px;
 width: 60px;
 position: relative;
 height: 32px;
}
.check {
 display: block;
 width: 30px;
 height: 30px;
 border-radius: 50%;
 background: #fff ;
 border: 1px solid #e5e5e5;
 position: absolute;
 top: 0px;
 left: 0px;
}
input[type=checkbox] {
 border: 0 none !important;
 clip: rect(1px,1px,1px,1px);
 height: 1px !important;
 overflow: hidden !important;
 position: absolute !important;
 width: 1px !important;
}

@keyframes labelON {
 0% {
  top: 0px;
  left: 0px;
 }    
 100% {
  top: 0px;
  left: 28px;
 }
}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657

更多请见:https://blog.csdn.net/weixin_44519496/article/details/120152358

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档