Back to CSS Card Hover Effects Magnetic Float Pure CSS
Share
HTML
<div class="card-17">
  <div class="card-17__dot card-17__dot--a"></div>
  <div class="card-17__dot card-17__dot--b"></div>
  <div class="card-17__dot card-17__dot--c"></div>
  <span class="card-17__tag">Float</span>
  <h4 class="card-17__title">Magnetic Float</h4>
  <p class="card-17__body">Orbit dots scatter on hover with spring easing.</p>
</div>
CSS
.card-17__tag {
  font-family: monospace;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(124, 108, 255, 0.15);
  color: #7c6cff;
  border: 1px solid rgba(124, 108, 255, 0.3);
  display: inline-block;
  margin-bottom: 10px;
}
.card-17__title {
  font-size: 17px;
  font-weight: 700;
  color: #f0eeff;
  margin-bottom: 6px;
}
.card-17__body {
  font-size: 13px;
  color: #b8b6d4;
  line-height: 1.6;
}
.card-17 {
  width: 100%;
  max-width: 280px;
  position: relative;
  overflow: visible;
  padding: 22px;
  border-radius: 14px;
  background: #17171f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition:
    transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.42s;
}
.card-17:hover {
  transform: translateY(-10px);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.42);
}
.card-17__dot {
  position: absolute;
  border-radius: 50%;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.card-17__dot--a {
  width: 11px;
  height: 11px;
  background: #7c6cff;
  top: 18px;
  right: 18px;
}
.card-17__dot--b {
  width: 8px;
  height: 8px;
  background: #ff6c8a;
  bottom: 22px;
  left: 22px;
}
.card-17__dot--c {
  width: 6px;
  height: 6px;
  background: #1ed98a;
  top: 50%;
  right: 14px;
}
.card-17:hover .card-17__dot--a {
  transform: translate(10px, -12px) scale(1.5);
}
.card-17:hover .card-17__dot--b {
  transform: translate(-10px, 10px) scale(1.4);
}
.card-17:hover .card-17__dot--c {
  transform: translate(8px, 0) scale(1.6);
}