Skip to content

Instantly share code, notes, and snippets.

@meetzaveri
Created July 13, 2020 08:22
Show Gist options
  • Save meetzaveri/7df69e03adc04a1a2d6c167006aec74e to your computer and use it in GitHub Desktop.
Save meetzaveri/7df69e03adc04a1a2d6c167006aec74e to your computer and use it in GitHub Desktop.
Adding image overlay on hover effect
<div class="img-upload-placeholder relative">
  <img class="opacity-05"/>
  <input class="absolute opacity-0 z-50 w-full h-full cursor-pointer"/>
</div>

Imagine these classes of tailwind utility classes as h-full means height: 100% and so on...

.img-upload-placeholder {
  border-radius: 50%;
  cursor: pointer;
}

.img-upload-placeholder:hover {
  transition: all 0.2s ease-in-out;
  background: rgba(0, 0, 0, 0.8);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment