js+svg实现radio中性胶囊开关效果代码

代码语言:html

所属分类:表单美化

代码描述:js+svg实现radio中性胶囊开关效果代码

代码标签: 中性 胶囊 开关 效果

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


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

<head>

  <meta charset="UTF-8">

  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Comfortaa:wght@600&display=swap");
:root {
  --highlight-left: 0;
  --pagination-width: 0;
}

html {
  height: 100%;
}

body {
  font-family: sans-serif;
  height: 100%;
  margin: 0;
  font-family: "Comfortaa", cursive;
  background-color: #eef3f7;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radio-checked {
  position: relative;
  font-size: 34px;
  letter-spacing: 1px;
  box-shadow: -6px -5px 14px 3px #fff, 7px 7px 12px 2px #d0d8e3;
  border-radius: 70px;
}
.radio-checked_input {
  display: none;
}
.radio-checked_input:checked + .radio-checked_label--on {
  color: #47cf73;
  text-shadow: 0 0 7px rgba(71, 207, 115, 0.6);
}
.radio-checked_input:checked + .radio-checked_label--off {
  color: #ff3c41;
  text-shadow: 0 0 7px rgba(255, 60, 65, 0.6);
}
.radio-checked_input:checked + .radio-checked_label:before {
  display: none;
}
.radio-checked_label {
  cursor: pointer;
  display: inline-block;
  padding: 20px 25px 15px;
  line-height: 1;
  border-radius: 3rem;
  color: #acb2c0;
  transition: all 150ms ease-in-out;
}
.radio-checked_label:before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  display: block;
}
.radio-checked_container {
  position: relative;
}
.radio-checked_highlight {
  position: absolute;
  left: 0;
  bottom: 0;
  width: var(--pagination-width);
  height: 100%;
  border-radius: 70px;
  box-shadow: inset -5px -5px 10px 4px #fff, inset -2px 6px 8.........完整代码请登录后点击上方下载按钮下载查看

网友评论0