Align text into a column - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Column Layout

Description

Align text into a column

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">

.center {<!--from  ww  w.  ja va  2  s. c om-->
   display: table;
   margin: 0 auto;
}
table {
   background:rgb(0, 118, 168);
   color:#FFF;
   font-family:Arial;
}
th, td {
   border:1px dashed #FFF;
   padding:10px;
}
#number1 tbody tr {
   position:relative;
}
#number1 .scooch {
   position:absolute;
   top:55px;
   left:90px;
}
#number2 tbody tr td {
   position:relative;
}
#number2 .scooch {
   position:absolute;
   top:10px;
   left:25px;
}


      </style> 
 </head> 
 <body> 
  <table id="number1"> 
   <thead> 
    <tr> 
     <th>Price</th> 
     <th>Item Total</th> 
    </tr> 
   </thead> 
   <tbody> 
    <tr> 
     <td>$14</td> 
     <td class="scooch">$14</td> 
    </tr> 
   </tbody> 
  </table> 
  <br> 
  <table id="number2"> 
   <thead> 
    <tr> 
     <th>Price</th> 
     <th>Item Total</th> 
    </tr> 
   </thead> 
   <tbody> 
    <tr> 
     <td>123123</td> 
     <td> <span class="scooch">2123</span> </td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials