css实现checkbox胶囊软开关点击切换效果代码

代码语言:html

所属分类:表单美化

代码描述:css实现checkbox胶囊软开关点击切换效果代码

代码标签: css 胶囊 软开关 点击 切换 checkbox

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
<style>
body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1em;
  min-height: 100vh;
  font-size: 2em;
}

.toggle-container {
  position: relative;
  border-radius: 3.125em;
  width: 3.25em;
  height: 1.875em;
}

.toggle-checkbox {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  z-index: 1;
  border-radius: inherit;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.toggle-track {
  display: flex;
  align-items: center;
  position: relative;
  border-radius: inherit;
  padding: 0.25em;
  width: 100%;
  height: 100%;
  background-color: #aeaeae;
  box-.........完整代码请登录后点击上方下载按钮下载查看

网友评论0