پیش‌نمایش زنده
کد HTML
<div class="container">
  <button class="btn">hover me</button>
  <p class="msg">With only one button element 🐱‍👤</p>
</div>
کد CSS
/*Global btn styles*/
.btn {
  position: relative;
  display: inline-block;
  cursor: pointer;
  outline: none;
  vertical-align: middle;
  text-decoration: none;
  background: transparent;
  font-size: 15px;
  border: none;
}
/*Container styles*/
.container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 15px;
}
/*Main button styles*/
.btn {
  position: relative;
  height: fit-content;
  display: flex;
  justify-content: left;
  align-items: center;
  width: 140px;
  height: 40px;
  text-align: center;
  text-transform: uppercase;
  text-indent: 50px;
  transition: 300ms;
  font-weight: 500;
}

.btn::before {
  content: "";
  transition: all 0.45s cubic-bezier(0.65, 0, 0.076, 1);
  position: absolute;
  left: 0;
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background-color: #282936;
  z-index: -1;
}

.btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 17px;
  transform: translate(-50%, -50%) rotate(45deg);
  width: 12px;
  height: 12px;
  border-top: 2px solid #fff;
  border-right: 2px solid #fff;
  transition: 400ms;
}

.btn:hover {
  text-indent: 15px;
  color: white;
  font-weight: 600;
}
.btn:active {
  scale: 0.95;
}

.btn:hover::before {
  width: 100%;
}

.btn:hover::after {
  left: calc(100% - 25px);
}
نوع: button
تاریخ ایجاد: 2026/06/05
آخرین بروزرسانی: 2026/06/05