پیش‌نمایش زنده
کد HTML
<div class="wrap">
  <div class="back"></div>
  <div class="main">
  <label class="switch">
    <input name="value-radio" type="radio">
    <div class="button">
      <div class="light"></div>
      <div class="dots"></div>
    </div>
  </label>
  <label class="switch1">
    <input name="value-radio" checked="" type="radio">
    <div class="button">
      <div class="light"></div>
      <div class="dots"></div>
    </div>
  </label>
  <label class="switch2">
    <input name="value-radio" checked="" type="radio">
    <div class="button">
      <div class="light"></div>
      <div class="dots"></div>
    </div>
  </label>
  </div>
</div>
کد CSS
/*Design Inspired by @ykadosh on Codepen*/

.wrap {
  --black: #000000;
  --ch-black: #141414;
  --eer-black: #1b1b1b;
  --night-rider: #2e2e2e;
  --white: #ffffff;
  --af-white: #f3f3f3;
  --ch-white: #e1e1e1;
  font-family: Helvetica, sans-serif;
}

.back {
  position: absolute;
  width: 16.6em;
  height: 6.5em;
  margin-top: -0.8em;
  margin-left: -0.77em;
  border-radius: 8px;
  box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 2px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -1px 0px inset;
  background-color: #171717;
}

.main {
  display: flex;
}

.switch {
  display: block;
  position: relative;
  background-color: black;
  width: 70px;
  height: 70px;
  box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.2), 0 0 1px 2px  var(--black), inset 0 2px 2px -2px  var(--white), inset 0 0 2px 5px var(--night-rider), inset 0 0 2px 22px  var(--black);
  border-radius: 50%;
  padding: 20px;
  margin: 5px;
}

.switch input {
  display: none;
}

.switch input:checked + .button .light {
  animation: flicker 0.2s infinite 0.3s;
}

.switch input:checked + .button .shine {
  opacity: 1;
}

.switch input:checked + .button .shadow {
  opacity: 0;
}

.switch .button {
  transition: all 0.3s cubic-bezier(1, 0, 1, 1);
  background-color: var(--night-rider);
  width: 55px;
  height: 55px;
  border-radius: 50%;
  position: relative;
  left: -0.75em;
  top: -0.79em;
  cursor: pointer;
}

.switch .light {
  opacity: 0;
  animation: light-off 1s;
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(var(--ch-white), var(--white) 70%, transparent 72%);
}

.switch .dots {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(transparent 30%, var(--black) 70%);
  background-size: 10px 10px;
  border-radius: 50%;
}

@keyframes flicker {
  0% {
    opacity: 1;
  }

  80% {
    opacity: 0.8;
  }

  100% {
    opacity: 1;
  }
}

@keyframes light-off {
  0% {
    opacity: 1;
  }

  80% {
    opacity: 0;
  }
}

.switch1 {
  display: block;
  position: relative;
  background-color: var(--black);
  width: 70px;
  height: 70px;
  box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.2), 0 0 1px 2px  var(--black), inset 0 2px 2px -2px  var(--white), inset 0 0 2px 5px var(--night-rider), inset 0 0 2px 22px  var(--black);
  border-radius: 50%;
  padding: 20px;
  margin: 5px;
}

.switch1 input {
  display: none;
}

.switch1 input:checked + .button .light {
  animation: flicker 0.2s infinite 0.3s;
}

.switch1 input:checked + .button .shine {
  opacity: 1;
}

.switch1 input:checked + .button .shadow {
  opacity: 0;
}

.switch1 .button {
  transition: all 0.3s cubic-bezier(1, 0, 1, 1);
  background-color: var(--night-rider);
  width: 55px;
  height: 55px;
  border-radius: 50%;
  position: relative;
  left: -0.75em;
  top: -0.79em;
  cursor: pointer;
}

.switch1 .light {
  opacity: 0;
  animation: light-off 1s;
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(var(--ch-white), var(--white) 70%, transparent 72%);
}

.switch1 .dots {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(transparent 30%, var(--black) 70%);
  background-size: 10px 10px;
  border-radius: 50%;
}

.switch2 {
  display: block;
  position: relative;
  background-color: var(--black);
  width: 70px;
  height: 70px;
  box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.2), 0 0 1px 2px  var(--black), inset 0 2px 2px -2px  var(--white), inset 0 0 2px 5px var(--night-rider), inset 0 0 2px 22px  var(--black);
  border-radius: 50%;
  padding: 20px;
  margin: 5px;
}

.switch2 input {
  display: none;
}

.switch2 input:checked + .button .light {
  animation: flicker 0.2s infinite 0.3s;
}

.switch2 input:checked + .button .shine {
  opacity: 1;
}

.switch2 input:checked + .button .shadow {
  opacity: 0;
}

.switch2 .button {
  transition: all 0.3s cubic-bezier(1, 0, 1, 1);
  background-color: var(--night-rider);
  width: 55px;
  height: 55px;
  border-radius: 50%;
  position: relative;
  left: -0.75em;
  top: -0.79em;
  cursor: pointer;
}

.switch2 .light {
  opacity: 0;
  animation: light-off 1s;
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(var(--ch-white), var(--white) 70%, transparent 72%);
}

.switch2 .dots {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(transparent 30%, var(--black) 70%);
  background-size: 10px 10px;
  border-radius: 50%;
}
نوع: radio
تاریخ ایجاد: 2026/06/06
آخرین بروزرسانی: 2026/06/06