پیش‌نمایش زنده
کد HTML
<button class="container">
  <a href="#"></a>
  <a href="#"></a>
  <a href="#"></a>
  <a href="#"></a>
  <div class="card">
    <div class="card-header">
      HOVER
    </div>
  </div>
</button>
کد CSS
.container {
  border: none;
}

.container .card {
  background-color: white;
  border-radius: 10px;
  border: 1px solid black;
  position: relative;
  z-index: 0;
  transition: all 300ms ease-out;
  transform-origin: center center;
  width: 150px;
  height: 50px;
  box-shadow: 0px;
  outline: none;
}

.card-header {
  padding: 10px;
  background: linear-gradient(90deg, #CB2D6F 20px, transparent 100%) center / 22px 22px,
		linear-gradient(#CB2D6F 20px, transparent 100%) center / 22px 22px,
		#fff;
  color: white;
  height: 100%;
  font-size: 20px;
  font-weight: 600;
  border: 1px solid white;
  border-radius: 10px;
}

.container .card .border {
  transition: all 300ms ease-out;
  transform-origin: center center;
  position: absolute;
  top: 6px;
  left: 6px;
  width: calc(100% - 0px);
  height: calc(100% - 0px);
  border: 1px solid black;
  border-radius: 9px;
}

.container a {
  opacity: 0;
  position: absolute;
  z-index: 1;
  width: 50%;
  height: 50%;
}

.container a:hover,
.container a:focus {
  transform: translateZ(50px);
}

.container a:hover ~ .card .card-header,
.container a:focus ~ .card .card-header {
  transform: translateZ(24px);
}

.container a:nth-child(1) {
  top: 0;
  left: 0;
}

.container a:nth-child(1):hover ~ .card,
.container a:nth-child(1):focus ~ .card {
  transform: rotateX(10deg) rotateY(-10deg) translateZ(0);
  transform-origin: right bottom;
  box-shadow: 10px 20px;
}

.container a:nth-child(2) {
  top: 0;
  right: 0;
}

.container a:nth-child(2):hover ~ .card,
.container a:nth-child(2):focus ~ .card {
  transform: rotateX(10deg) rotateY(10deg) translateZ(0);
  transform-origin: left bottom;
  box-shadow: -10px 20px;
}

.container a:nth-child(3) {
  bottom: 0;
  right: 0;
}

.container a:nth-child(3):hover ~ .card ,
.container a:nth-child(3):focus ~ .card {
  transform-origin: left top;
  transform: rotateX(-10deg) rotateY(10deg) translateZ(0);
  box-shadow: -10px -20px;
}

.container a:nth-child(4) {
  bottom: 0;
  left: 0;
}

.container a:nth-child(4):hover ~ .card,
.container a:nth-child(4):focus ~ .card {
  transform-origin: right top;
  transform: rotateX(-10deg) rotateY(-10deg) translateZ(0);
  box-shadow: 10px -20px;
}
نوع: button
تاریخ ایجاد: 2026/06/05
آخرین بروزرسانی: 2026/06/05