پیش‌نمایش زنده
کد HTML
<div class="container">
  <input id="switch" type="checkbox" class="input" />
  <div class="app">
    <div class="body">
      <div class="phone">
        <div class="menu">
          <div class="time">4:20</div>
          <div class="icons">
            <div class="network"></div>
            <div class="battery"></div>
          </div>
        </div>
        <div class="content">
          <div class="circle">
            <div class="crescent"></div>
          </div>
          <label for="switch" class="label">
            <div class="toggle"></div>
            <div class="names">
              <p class="light">DAY</p>
              <p class="dark">NIGHT</p>
            </div>
          </label>
        </div>
      </div>
    </div>
  </div>
</div>
کد CSS
.container {
  width: 100%;
  height: 100%;
  margin: 0;
}
.app {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.body {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f0e8d5;
  transition: background-color 0.3s ease-in-out;
}

.phone {
  position: relative;
  z-index: 2;
  width: 18rem;
  height: 23rem;
  background-color: #f9f9f9;
  box-shadow: 8px 8px 0px #000;
  border-radius: 40px;
  display: flex;
  flex-direction: column;
  border: 4px solid #000;
}

.menu {
  font-size: 80%;
  opacity: 0.8;
  padding: 0.8rem 1.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.icons {
  display: flex;
  align-items: center;
}

.battery {
  width: 0.85rem;
  height: 0.55rem;
  background-color: #000;
  border: 1px solid #000;
  margin-bottom: 4px;
}

.network {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 7px 9px 7px;
  border-color: transparent transparent #000 transparent;
  transform: rotate(135deg);
  margin: 0.12rem 0.4rem;
}

.content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-content: space-between;
  margin: auto;
  text-align: center;
  width: 80%;
  transform: translateY(5%);
}

.circle {
  position: relative;
  border-radius: 100%;
  width: 8rem;
  height: 8rem;
  background: linear-gradient(40deg, #d90429, #efb700 70%);
  margin: auto;
  border: 4px solid #0000000;
}

.crescent {
  position: absolute;
  border-radius: 100%;
  right: 0;
  width: 6rem;
  height: 6rem;
  background: white;
  transform: scale(0);
  transform-origin: top right;
  transition: transform 0.6s cubic-bezier(0.645, 0.045, 0.355, 1);
}

.label,
.toggle {
  height: 4rem;
  border-radius: 100px;
}

.label {
  width: 100%;
  background-color: #d1d1d1;
  background-image: radial-gradient(#000000 15%, transparent 16%),
    radial-gradient(#000000 15%, transparent 16%);
  background-size: 10px 10px;
  background-position:
    0 0,
    5px 5px;
  border-radius: 100px;
  position: relative;
  margin: 3rem 0 4rem 0;
  cursor: pointer;
  border: 4px solid #000;
}

.toggle {
  position: absolute;
  width: 50%;
  top: -4px;
  left: -4px;
  background-color: #29a9ff;
  box-shadow: 4px 4px 0px #000;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border: 4px solid #000;
  box-sizing: border-box;
}

.names {
  font-size: 150%;
  text-align: center;
  color: #000;
  text-shadow:
    2px 2px 0 #fff,
    -2px -2px 0 #fff,
    2px -2px 0 #fff,
    -2px 2px 0 #fff;
  width: 70%;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-style: italic;
  display: flex;
  justify-content: space-between;
  user-select: none;
  z-index: 10;
}

.dark {
  opacity: 0;
  right: 12%;
  top: 50%;
  transform: translateY(-50%);
  position: absolute;
}

.light {
  opacity: 1;
  left: 14%;
  top: 50%;
  transform: translateY(-50%);
  position: absolute;
}

.time {
  color: #000;
}

.container .input {
  display: none;
}

.container .input:checked + .app .toggle {
  transform: translateX(103%);
  background-color: #ffc107;
}

.container .input:checked + .app .dark {
  opacity: 1;
  color: #ffc107;
  text-shadow:
    2px 2px 0 #000,
    -2px -2px 0 #000,
    2px -2px 0 #000,
    -2px 2px 0 #000;
}

.container .input:checked + .app .light {
  opacity: 0;
  color: #fff;
  text-shadow: none;
}

.container .input:checked + .app .body {
  background-color: #1e3d59;
}

.container .input:checked + .app .phone {
  background-color: #34495e;
}

.container .input:checked + .app .crescent {
  transform: scale(1);
  background: #34495e;
}

.container .input:checked + .app .circle {
  background: linear-gradient(40deg, #d3bcff, #ffffff 70%);
  border: none;
}

.container .input:checked + .app .body .phone .menu .time {
  color: #fff;
}

.container .input:checked + .app .body .phone .menu .icons .network {
  border-color: transparent transparent #fff transparent;
}

.container .input:checked + .app .body .phone .menu .icons .battery {
  background-color: #fff;
}
نوع: card
تاریخ ایجاد: 2026/06/06
آخرین بروزرسانی: 2026/06/06