CSS background overlay

PHOTO EMBED

Wed Jul 19 2023 22:04:41 GMT+0000 (Coordinated Universal Time)

Saved by @thecowsays #css

.details-container::before {
  content: "";
  position: absolute;
  top: 0; /* can delete top/left etc if sizes are 100% */
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.5);
  z-index: -1; /* must be lower number than objects needing to be in front */
}
content_copyCOPY

Must use z-index to ensure the overlay is behind other elements. For example, an image or a div with content would need a z-index higher than the overlay's z-index.