Typography · 30 of 33

Split Hover

Text splits and reveals alternate version

HTML · CSS · No dependencies · MIT

HTML

<div class="split-hover-wrapper">
  <div class="split-hover-inner">
    <span class="split-top">Menu</span>
    <span class="split-bottom">Open</span>
  </div>
</div>

CSS

.split-hover-wrapper {
  position: relative;
  overflow: hidden;
  height: 3.5rem; /* must match .split-top/.split-bottom height */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  font-weight: 600;
}

.split-hover-inner {
  display: block;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

.split-hover-wrapper:hover .split-hover-inner {
  transform: translateY(-3.5rem);
}

.split-top,
.split-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 3.5rem;
}

.split-bottom {
  color: #7c5cff;
}