Answers for "css transparent black overlay on background image"

CSS
5

how to have a background image with a color overlay

/* Working method */
.tinted-image {
  background: 
    /* top, transparent red, faked with gradient */ 
    linear-gradient(
      rgba(255, 0, 0, 0.45), 
      rgba(255, 0, 0, 0.45)
    ),
    /* bottom, image */
    url(image.jpg);
}
Posted by: Guest on January-04-2021
0

black background overlay filter | black overlay for image css

Exp:
<header>
  <img src="https://picsum.photos/id/1036/4608/3072" alt="Placeholder-Image">
  <section>
    <h1>Heading</h1>
    <h2>Just another tech blog.</h2>
    <button>Read more.</button>
  </section>
</header>

Add This Css:
header img {
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  filter: brightness(.4);
}


section {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-family: 'Roboto', sans-serif;
}
Posted by: Guest on March-06-2022

Code answers related to "css transparent black overlay on background image"

Browse Popular Code Answers by Language