Transparent layer of text over an image - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Text

Description

Transparent layer of text over an image

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
.image-container {<!--  w  w  w .  ja  va2  s . c  om-->
   position:relative;
}

.caption {
   width:100%;
   background:Chartreuse;
   color:yellow;
   position:absolute;
   top:0;
}
</style> 
 </head> 
 <body> 
  <div class="image-container"> 
   <img src="https://www.java2s.com/style/demo/Opera.png"> 
   <p class="caption">Lorem i</p> 
  </div>  
 </body>
</html>

Related Tutorials