Back to CSS Card Hover Effects Gradient Border Draw Pure CSS
Share
HTML
<div class="card-02">
  <span class="card-02__tag">Frontend</span>
  <h4 class="card-02__title">Border Draw</h4>
  <p class="card-02__body">A gradient border traces itself on hover.</p>
</div>
CSS
.card-02__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-02__title {
  font-size: 17px;
  font-weight: 700;
  color: #f0eeff;
  margin-bottom: 6px;
}
.card-02__body {
  font-size: 13px;
  color: #b8b6d4;
  line-height: 1.6;
}
.card-02 {
  width: 100%;
  max-width: 280px;
  position: relative;
  padding: 22px;
  border-radius: 14px;
  background: #17171f;
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  z-index: 0;
  transition: border-color 0.3s;
}
.card-02::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: 15.5px;
  background: conic-gradient(from 0deg, #7c6cff, #ff6c8a, #3de8f5, #1ed98a, #7c6cff);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s;
}
.card-02::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background: #17171f;
  z-index: -1;
}
.card-02:hover::before {
  opacity: 1;
}
.card-02:hover {
  border-color: transparent;
}