interactions · hover · image

Hover image

Vignette qui assombrit l'image et fait apparaître une icône au survol, pour signaler qu'elle est cliquable.

Voir le code source
<style>
.bn-hover-image {
  position: relative;
  display: block;
  max-width: 340px;

  font-family: 'Inter', sans-serif;
  text-decoration: none;

  border-radius: 6px;
  overflow: hidden;
}

.bn-hover-image img {
  width: 100%;
  display: block;
  transition: transform 0.4s ease;
}

.bn-hover-image:hover img {
  transform: scale(1.05);
}

.bn-hover-image__default {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1rem;

  display: flex;
  align-items: flex-end;
  justify-content: space-between;

  background: linear-gradient(to top, rgba(5, 8, 8, 0.85), transparent);
  transition: opacity 0.3s ease;
}

.bn-hover-image__default strong {
  display: block;
  color: #E6E4DD;
  font-size: 0.95rem;
}

.bn-hover-image__default small {
  color: #C7C1B7;
  font-size: 0.75rem;
}

.bn-hover-image__default .bn-hover-image__icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(230, 228, 221, 0.4);
  color: #E6E4DD;

  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.bn-hover-image__hover {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(5, 8, 8, 0.55);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.bn-hover-image__eye {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(230, 228, 221, 0.5);
  color: #E6E4DD;

  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.bn-hover-image:hover .bn-hover-image__default {
  opacity: 0;
}

.bn-hover-image:hover .bn-hover-image__hover {
  opacity: 1;
}

</style>

<a href="#" class="bn-hover-image">
  <img src="https://placehold.co/400x260" alt="Signal 07" />

  <span class="bn-hover-image__default">
    <strong>Signal 07</strong>
    <small>Série visuelle</small>
    <span class="bn-hover-image__icon">+</span>
  </span>

  <span class="bn-hover-image__hover">
    <span class="bn-hover-image__eye">◎</span>
  </span>
</a>