Add row header and before content - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Header

Description

Add row header and before content

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">
body {<!--   ww  w.ja v  a2 s .c om-->
   font:17px Calibri;
}

table {
   border-collapse:separate;
   border-top:4px solid Chartreuse;
}

td, th {
   margin:0;
   border:4px solid yellow;
   border-top-width:0px;
   white-space:nowrap;
}

div {
   width:601px;
   overflow-x:scroll;
   margin-left:6em;
   overflow-y:visible;
   padding-bottom:2px;
}

.headcol {
   position:absolute;
   width:6em;
   left:0;
   top:auto;
   border-right:0px none blue;
   border-top-width:4px;
   margin-top:-4px;
}

.headcol:before {
   content:'Row ';
}

.long {
   background:yellow;
   letter-spacing:2em;
}
</style> 
 </head> 
 <body> 
  <div> 
   <table> 
    <tbody> 
     <tr> 
      <th class="headcol">L</th> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
     </tr> 
     <tr> 
      <th class="headcol">L</th> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
     </tr> 
     <tr> 
      <th class="headcol">L</th> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
     </tr> 
     <tr> 
      <th class="headcol">L</th> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
     </tr> 
     <tr> 
      <th class="headcol">L</th> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
     </tr> 
     <tr> 
      <th class="headcol">L</th> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
     </tr> 
     <tr> 
      <th class="headcol">L</th> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
     </tr> 
     <tr> 
      <th class="headcol">L</th> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
     </tr> 
     <tr> 
      <th class="headcol">L</th> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
      <td class="long">Lorem ipsum dolor sit amet</td> 
     </tr> 
    </tbody> 
   </table> 
  </div>  
 </body>
</html>

Related Tutorials