image overlay javascript. code example

Example 1: css overlay

#hero{
  background-image:url();
  background-size:cover;
  background-position:top center;
  position:relative;
}

#hero::after{
  content:'';
  position:absolute;
  left:0;
  top:0;
  height:100%;
  width:100%;
  background-color:black;
  opacity:0.7;
}

Example 2: overlay color on image css

footer#site-footer{  
  position:relative;
}

footer#site-footer:before {     /* use before property (pseudo-element)  */
    position: absolute;
    content: '';
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
}

Tags:

Css Example