wrap the border of a table around rows that are not full - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Row

Description

wrap the border of a table around rows that are not full

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <style>
table {<!--  w  w w .ja  v  a  2s.c o m-->
   display:block;
}

tr {
   display:block;
   float:left;
   clear:left;
   position:relative;
   border-style:solid;
   border-width:4px;
   background-color:Chartreuse;
   border-color:yellow;
}

tr:nth-child(n+2) {
   border-width:0 4px 4px 4px;
}

tr:nth-child(n+2)::before {
   content:"";
   display:block;
   background-color:blue;
   position:absolute;
   width:100%;
   top:-4px;
   height:5px;
}

tr:nth-child(n+2)::after {
   content:"";
   display:block;
   background-color:pink;
   position:absolute;
   width:4px;
   height:5px;
   top:-4px;
   left:-4px;
}

td {
   display:inline-block;
   border:2px solid OrangeRed;
   margin:3px
}
</style> 
 </head> 
 <body translate="no"> 
  <table> 
   <tbody> 
    <tr> 
     <td>L</td> 
     <td>L</td> 
    </tr> 
    <tr> 
     <td>L</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials