Skip to content Skip to sidebar Skip to footer

Set Background Image With Transparent Color And Also Make The Height Of The Image Adapt To The Content

.about { width: 100%; height: 300px; background-color: rgba(0,0,0,0.55); } I am trying to set a black color with 55% transparency to the image. Also I need the height of the

Solution 1:

.about {
  width: 100%;
  height: 100%;
  position:relative;
}
.about:after{
   content : "";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    background:url('http://i.imgur.com/tENv1w4.jpg') no-repeat center center; 
    width: 100%;
    height: 100%;
    opacity : 0.55;
    z-index: -1;
}

.text {
  color: #fff;
  font-size: 22px;
  text-align: center;
}

Check this fiddle for your solution.

https://jsfiddle.net/n5qfa/89/

Post a Comment for "Set Background Image With Transparent Color And Also Make The Height Of The Image Adapt To The Content"