AI CSS Animations

Isometric Card Hover

A card laid out in isometric view with visible thickness. On hover it floats up off the surface while its shadow slides away and softens. Real side faces, so the slab has depth at any size.

Also known as: isometric hover effect, 3d floating tile, iso card raise css.

Workspace 12 members

HTML

<div class="hfx-isometric-card">
  <div class="hfx-isometric-card-plane">
    <div class="hfx-isometric-card-shadow"></div>
    <div class="hfx-isometric-card-slab">
      <div class="hfx-isometric-card-face">
        <span class="hfx-isometric-card-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/></svg></span>
        <strong>Workspace</strong>
        <small>12 members</small>
      </div>
      <span class="hfx-isometric-card-side-y"></span>
      <span class="hfx-isometric-card-side-x"></span>
    </div>
  </div>
</div>

CSS

.hfx-isometric-card {
  --c: var(--hfx-color, #3b82f6);
  font-size: var(--hfx-size, 16px);
  perspective: 80em;
  font-family: system-ui, sans-serif;
}
.hfx-isometric-card-plane {
  position: relative;
  width: 9em;
  height: 6em;
  transform-style: preserve-3d;
  transform: rotateX(55deg) rotateZ(-45deg);
}
.hfx-isometric-card-shadow {
  position: absolute;
  inset: 0;
  border-radius: 0.5em;
  background: color-mix(in srgb, var(--c) 40%, #000);
  opacity: 0.3;
  filter: blur(0.25em);
  transform: translate(-0.2em, 0.2em);
  transition: transform 0.45s ease, opacity 0.45s ease, filter 0.45s ease;
}
.hfx-isometric-card-slab {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: translateZ(0.5em);
  transition: transform 0.45s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.hfx-isometric-card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0.9em 1em;
  border-radius: 0.5em;
  background: #fff;
  color: #111827;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 20%, transparent);
}
.hfx-isometric-card-icon {
  position: absolute;
  top: 0.9em;
  left: 1em;
  display: grid;
  place-items: center;
  width: 2em;
  height: 2em;
  border-radius: 0.5em;
  background: var(--c);
  color: #fff;
}
.hfx-isometric-card-icon svg {
  width: 1.1em;
  height: 1.1em;
}
.hfx-isometric-card-face strong {
  font-size: 1em;
}
.hfx-isometric-card-face small {
  font-size: 0.75em;
  color: #6b7280;
}
.hfx-isometric-card-side-y,
.hfx-isometric-card-side-x {
  position: absolute;
}
.hfx-isometric-card-side-y {
  top: 100%;
  left: 0.2em;
  right: 0.2em;
  height: 0.5em;
  background: color-mix(in srgb, var(--c) 55%, #fff);
  transform-origin: 50% 0;
  transform: rotateX(-90deg);
}
.hfx-isometric-card-side-x {
  top: 0.2em;
  bottom: 0.2em;
  right: 100%;
  width: 0.5em;
  background: var(--c);
  transform-origin: 100% 50%;
  transform: rotateY(-90deg);
}
.hfx-isometric-card:hover .hfx-isometric-card-slab {
  transform: translateZ(2.4em);
}
.hfx-isometric-card:hover .hfx-isometric-card-shadow {
  opacity: 0.18;
  filter: blur(0.6em);
  transform: translate(-1.1em, 1.1em);
}

@media (prefers-reduced-motion: reduce) {
  .hfx-isometric-card, .hfx-isometric-card *, .hfx-isometric-card::before, .hfx-isometric-card::after, .hfx-isometric-card *::before, .hfx-isometric-card *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --hfx-color on the element or a parent. Currently previewing #3b82f6.
  • Base size: set --hfx-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 16px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar hover effects