div+css布局实现十几种风格动效的checkbox开关效果代码
代码语言:html
所属分类:布局界面
代码描述:div+css布局实现十几种风格动效的checkbox开关效果代码
代码标签: div css 布局 十几 风格 动效 checkbox 开关
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@import url(https://fonts.googleapis.com/css?family=Montserrat);
body {
font-family: "Arial", sans-serif;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
padding: 20px;
}
.container {
text-align: center;
background-color: white;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
padding: 30px;
}
.toggle-grid {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: 30px;
}
.toggle-item {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 20px;
}
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: 0.4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
transition: 0.4s;
}
.switch input:checked + .slider {
background-color: #2196f3;
}
.switch input:checked + .slider:before {
transform: translateX(26px);
}
.round {
border-radius: .........完整代码请登录后点击上方下载按钮下载查看
















网友评论0