Override a border on a TR for border on a TD - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Border

Description

Override a border on a TR for border on a TD

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 {<!-- w  w  w  . ja va 2  s .co m-->
   border-collapse: collapse;
   background-color: rgb(202,217,234);
}
*#first { border: 1px solid black; }
table td {
   font-size: 12pt;
   padding: .5rem;
   border: 1px solid rgb(079,129,189);
}
table tr:hover {
   border: 2px solid crimson;
}
table tr:hover td {
   border: none;
}


      </style> 
 </head> 
 <body> 
  <table> 
   <colgroup> 
    <col id="first"> 
    <col id="second"> 
    <col id="third"> 
   </colgroup> 
   <thead> 
    <tr> 
     <th>A</th> 
     <th>B</th> 
     <th>C</th> 
    </tr> 
   </thead> 
   <tbody> 
    <tr> 
     <td>One</td> 
     <td>Fred</td> 
     <td>Jim</td> 
    </tr> 
    <tr> 
     <td>Two</td> 
     <td>Demo</td> 
     <td>Item</td> 
    </tr> 
    <tr> 
     <td>Three</td> 
     <td>Foo</td> 
     <td>Bar</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials