HTML table caption as part of header row - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Row

Description

HTML table caption as part of header row

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">
div {<!--from   w  ww.j a  v a  2  s.c o m-->
   background-color:Chartreuse;
}

table {
   border:2px solid yellow;
   width:100%;
}

table caption {
   line-height:0;
   text-align:left;
}

table caption span {
   position:relative;
   left:5px;
   top:15px;
}

table th {
   background-color:blue;
}

.captionRow th {
   text-align:right;
}
</style> 
 </head> 
 <body> 
  <div> 
   <table> 
    <caption> 
     <span>Lorem i</span> 
    </caption> 
    <thead> 
     <tr class="captionRow"> 
      <th colspan="2">Lorem ipsum d</th> 
     </tr> 
     <tr> 
      <th>Lorem i</th> 
      <th>Lorem i</th> 
     </tr> 
    </thead> 
    <tbody> 
     <tr> 
      <td>Lorem</td> 
      <td>Lorem</td> 
     </tr> 
    </tbody> 
   </table> 
  </div>  
 </body>
</html>

Related Tutorials