Overlay text onto an image in this example - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Text

Description

Overlay text onto an image in this example

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">
#timeline div[class*="block2x3"] .imgcontainer {
   height:67.7%;
}

#timeline div[class*="block2x3"] .commentcontainer {
   height:34.5%;
}

.overlay {<!--   w  w w  . j a v a  2  s  .co  m-->
   background:Chartreuse;
   color:yellow;
   left:16px;
   position:absolute;
   top:16px;
}
</style> 
 </head> 
 <body> 
  <div id="timeline"> 
   <div class="block2x3 block"> 
    <div class="imgcontainer"> 
     <img src="https://www.java2s.com/style/demo/InternetExplorer.png"> 
     <div class="overlay">
       Lorem ipsum dolor sit am 
     </div> 
    </div> 
    <div class="commentcontainer"> 
     <div class="peoples"> 
      <a href="#"> <strong class="peoplename">Lorem ips</strong> </a>Lorem 
      <a href="#">Lorem ipsum dolor sit amet,</a> 
      <p>Lorem ipsum dolor sit am<a href="#">Lorem ips</a> </p> 
     </div> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials