align three span inside a cell horizontally and add inner padding in span - HTML CSS CSS Property

HTML CSS examples for CSS Property:padding

Description

align three span inside a cell horizontally and add inner padding in span

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 av  a 2s  .  co  m-->
 {
   border-spacing:0px;
}

.sp1,.sp2,.sp3
 {
   margin:0px;
   padding:11px;
   display:inline-block;
}

.sp1
 {
   background-color:Chartreuse;
}

.sp2
 {
   background-color:yellow;
}

.sp3
 {
   background-color:blue;
}
</style> 
 </head> 
 <body> 
  <table border="1"> 
   <tbody> 
    <tr> 
     <td> <span class="sp1">Lorem ipsum d</span> <span class="sp2">Lorem ipsum dol</span> <span class="sp3">Lorem ipsum dolor </span> </td> 
    </tr> 
    <tr> 
     <td>Lorem</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials