Layout image and caption using table - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Caption

Description

Layout image and caption using table

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">
table, tbody, tr, td {
   display:block;
}

.view-title {<!-- w  w w  .j a v a2  s.  co  m-->
   float:left;
}

.view-image {
   display:table-row;
}

.view-description {
   display:table-row;
}
</style> 
 </head> 
 <body> 
  <table> 
   <tbody> 
    <tr> 
     <td class="view-title"> <h2>Lorem i</h2> </td> 
     <td class="view-image"> <img typeof="foaf:Image" src="https://www.java2s.com/style/demo/Opera.png" width="250" height="150" alt=""> </td> 
     <td class="view-description"> <h3>Lorem ipsum dolor sit amet, consectetur adipisc</h3> </td> 
    </tr> 
    <tr> 
     <td class="view-title"> <h2>Lorem i</h2> </td> 
     <td class="view-image"> <img typeof="foaf:Image" src="https://www.java2s.com/style/demo/Safari.png" width="250" height="150" alt=""> </td> 
     <td class="view-description"> <h3>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mo</h3> </td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials