Td positioning within tr - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

Td positioning within tr

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 {<!--  w ww.j  a v  a  2  s.co  m-->
   color:Chartreuse;
}

table {
   width:100%;
}

table * {
   box-sizing:border-box;
}

tr {
   display:block;
   width:100%;
   border:2px solid yellow;
   border-right:none;
   padding:0;
}

tr:before, tr:after {
   content:'';
   display:block;
}

tr:after {
   clear:both;
}

td {
   text-align:center;
   display:block;
   float:left;
   width:26%;
   border-right:2px solid blue;
}

td:nth-child(5) {
   width:100%;
   border-top:2px solid pink;
}

tr:nth-of-type(1n+2) {
   border-top:0;
}
</style> 
 </head> 
 <body> 
  <h3>Lorem ipsum do</h3> 
  <table> 
   <tbody> 
    <tr> 
     <td>L</td> 
     <td>L</td> 
     <td>L</td> 
     <td>L</td> 
     <td>L</td> 
    </tr> 
   </tbody> 
  </table> 
  <h3>Lorem ipsum </h3> 
  <table> 
   <tbody> 
    <tr> 
     <td>L</td> 
     <td>L</td> 
     <td>L</td> 
     <td>L</td> 
     <td>L</td> 
    </tr> 
    <tr> 
     <td>L</td> 
     <td>L</td> 
     <td>L</td> 
     <td>L</td> 
     <td>Lo</td> 
    </tr> 
    <tr> 
     <td>Lo</td> 
     <td>Lo</td> 
     <td>Lo</td> 
     <td>Lo</td> 
     <td>Lo</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials