Format numbers right aligned in a HTML table - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table

Description

Format numbers right aligned in a HTML 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 {<!--from w w w.  j  a v  a 2  s.c  o  m-->
   width:100%;
}

.freq {
   width:201px;
   text-align:left;
}

.freq span {
   width:71px;
   text-align:right;
   display:inline-block;
}

.freq span.over {
   text-alright:right;
}

.freq span.over::after {
   content:" / ";
}
</style> 
 </head> 
 <body> 
  <table> 
   <tbody> 
    <tr> 
     <th>Lore</th> 
     <th>Lore</th> 
     <th>Lorem ipsum d<br> </th> 
    </tr> 
    <tr> 
     <td>Lore</td> 
     <td class="freq"> <span class="over">L</span> <span>Lorem i</span> <br> </td> 
     <td>Lore</td> 
    </tr> 
    <tr> 
     <td>Lorem ip<br> </td> 
     <td class="freq"> <span class="over">Lo</span> <span>Lorem </span> <br> </td> 
     <td>Lore</td> 
    </tr> 
    <tr> 
     <td>Lorem </td> 
     <td class="freq"> <span class="over">Lore</span> <span>Lorem i</span> <br> </td> 
     <td>Lore</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials