Files
30-seconds-of-code/snippets/text-backdrop-overlay.md
Isabelle Viktoria Maciohsek 2487083cf1 Bake dates into snippets
2021-06-13 19:41:39 +03:00

675 B

title, tags, firstSeen, lastUpdated
title tags firstSeen lastUpdated
Image text overlay visual,beginner 2020-08-18T15:07:32+03:00 2020-12-30T15:37:37+02:00

Displays a text on top of an image using an overlay.

  • Use backdrop-filter to apply a blur(14px) and brightness(80%) effect to make text readable regardless of background image and color.
<div>
  <h3 class="text-overlay">Hello, World</h3>
  <img src="https://picsum.photos/id/1050/1200/800">
</div>
div {
  position: relative;
}

.text-overlay {
  position: absolute;
  top: 0;
  left: 0;
  padding: 1rem;
  font-size: 2rem;
  font-weight: 300;
  color: white;
  backdrop-filter: blur(14px) brightness(80%);
}