Reputation: 477
the css code:
#overlay {
background: rgba(0,0,0,0.8);
position: absolute;
z-index:100;
width: 100%;
color:#fff;
height: 100%;
}
the html code:
<div class="container" style="border:1px solid #000;">
<div class="row">
<div class="col-md-12">
<div id="overlay">Overlay</div>
Here goes the brief introduction of the company which has branded it's logo religious in almost its entire brand and now the world knows about it. Here goes the brief introduction of the company which has branded it's logo religious in almost its entire brand and now the world knows about it. Here goes the brief introduction of the company which has branded it's logo religious in almost its entire brand and now the world knows about it.
</div>
</div>
</div>
For some reason, i can't get the background overlay to show in the container. Check out the Demo: http://www.bootply.com/PJiifhEI8u
Upvotes: 1
Views: 2535
Reputation: 13666
Just add top:0;
and left:0;
positioning to the CSS:
#overlay {
background: rgba(0,0,0,0.8);
position: absolute;
z-index:100;
width: 100%;
color:#fff;
height: 100%;
top:0;
left:0;
}
Update based on your comment:
One way to add the padding to the overlay would be to use calc to make the overlay 30px less than 100% and then add a 15px left margin to center it:
#overlay {
background: rgba(0,0,0,0.8);
position: absolute;
z-index:100;
width:calc(100% - 30px);
color:#fff;
height: 100%;
top:0;
left:0;
margin-left:15px;
}
Upvotes: 1