Lompat ke konten Lompat ke sidebar Lompat ke footer

Widget HTML #1

Kode HTML untuk Tombol DARK MODE 02

 

Kode HTML Untuk Tombol

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

<b:includable id='darkmodeSwitch'>
  <div class='darkmode-switch'>
    <label class='switch-title'/>
    <label class='switch'>
      <input aria-label='checkbox' class='checkbox' onclick='darkMode()' type='checkbox'/>
      <span class='slider'>
        <i class='sun-icon'/>
        <i class='moon-icon'/>
      </span>
    </label>
  </div>
</b:includable>


Kode CSS Untuk Tombol

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

.darkmode-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0,0,0,0.2);
  padding: 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: background-color 0.3s ease-in-out;
  position: relative;
}

.darkmode-switch:hover {
  background-color: rgba(0,0,0,0.4);
}

.switch-title {
  display: inline-block;
  margin-right: 4px;
  color: #fff;
}

.switch {
  display: inline-block;
  position: relative;
  width: 40px;
  height: 24px;
  margin-left: 4px;
}

.switch input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #f1c40f;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: #f1f1f1;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 50%;
}

input[type="checkbox"]:checked + .slider:before {
  -webkit-transform: translateX(16px);
  -ms-transform: translateX(16px);
  transform: translateX(16px);
  background-color: #f1f1f1;
  content: "";
  background-image: url("https://i.pinimg.com/564x/6f/46/a1/6f46a1c736a289bfa2b230b6cc55b4f1.jpg"); /* gambar bulan sabit */
  background-size: cover;
}

input[type="checkbox"]:checked + .slider {
  background-color: #2980b9;
}

input[type="checkbox"] + .slider:before {
  content: "";
  background-image: url("https://i.pinimg.com/564x/ff/c5/6f/ffc56f986a2b3bdec95c20140bd4941f.jpg"); /* gambar matahari */
  background-size: cover;
  border-radius: 50%;
}

Posting Komentar untuk "Kode HTML untuk Tombol DARK MODE 02"