html - Text block over image with background the same length of the image -


i'm trying create text block transparent background same width image. if add padding header may overlap or not long enough due varying length in text.

currently looks this: http://puu.sh/sdbcx/994cc31da8.png

here relevant html:

<div class="container-fluid"> <div class="row">         <div class="artist-grid">             <div class="col-lg-2"></div>              <div class="col-lg-2">                  <img id="#artisttile" src="https://dummyimage.com/300x300">                   <h3><span>bassnectar</span></h3>             </div>              <div class="col-lg-2">                 <img id="#artisttile" src="https://dummyimage.com/300x300">                   <h3><span>datsik</span></h3>                                 </div>              <div class="col-lg-2">                 <img id="#artisttile" src="https://dummyimage.com/300x300">                   <h3><span>chainsmokers</span></h3>             </div>              <div class="col-lg-2">                 <img id="#artisttile" src="https://dummyimage.com/300x300">                   <h3><span>zeds dead</span></h3>             </div>              <div class="col-lg-2"></div>         </div>           </div> </div> 

and relevant css:

h3 {     position: absolute;     top: 244px;     width: 100% }  h3 span {     color: white;     background: rgb(0, 0, 0);     background: rgba(0, 0, 0, 0.7);     padding: 10px; }  .artist-grid {     padding-top: 22px; }  #artisttile {     position: relative;     max-width: 100%; } 

cheers!

div {   width: 200px;   height: 200px;   display: block;   position: relative; }  div::after {   content: "";   background: url(image.jpg);   opacity: 0.5;   top: 0;   left: 0;   bottom: 0;   right: 0;   position: absolute;   z-index: -1;    } 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -