Add caption to image with div - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Caption

Description

Add caption to image with div

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">
.pbtable {<!--  w w  w . j  a  va  2  s  .  c om-->
   display:table;
   margin:0 auto;
   width:501px;
}

.pbrow {
   display:table-row;
}

.pbcell {
   display:table-cell;
}
</style> 
 </head> 
 <body> 
  <div class="pbtable"> 
   <div class="pbrow"> 
    <div class="pbcell"> 
     <img src="https://www.java2s.com/style/demo/Opera.png" height="200px"> 
    </div> 
    <div class="pbcell"> 
     <img src="https://www.java2s.com/style/demo/Opera.png" height="200px"> 
    </div> 
   </div> 
   <div class="pbrow"> 
    <div class="pbcell">
      Lorem ipsum dolor si 
    </div> 
    <div class="pbcell">
      Lorem ipsum d 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials