Highlight a table cell - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Cell

Description

Highlight a table cell

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 {<!-- ww  w .  ja v  a 2  s  .c om-->
   font-family:"Arial", sans-serif;
}

h1 {
   text-align:center;
}

table {
   width:91%;
   border-collapse:collapse;
   border-color:Chartreuse;
}

th, td {
   padding:16px 2%;
   text-align:left;
   display:block;
}

tr {
   border:2px solid yellow;
}

td:nth-child(1) {
   width:19%;
   float:left;
}

td:nth-child(2) {
   width:49%;
   float:left;
}

td:nth-child(3) {
   width:29%;
   float:left;
   background-color:blue;
   color:pink;
}

th:first-child {
   width:19%;
   float:left;
}

th:nth-child(2) {
   width:79%;
   float:right;
   text-align:left;
}

th:nth-child(3) {
   display:none;
}

@media screen and ( max-width: 800px )  {
   td:nth-child(1) {
      width:19%;
      float:left;
   }
   
   td:nth-child(2) {
      width:79%;
      float:left;
   }
   
   td:nth-child(3) {
      width:99%;
      float:left;
      background-color:OrangeRed;
      color:grey;
   }

}
</style> 
 </head> 
 <body> 
  <table> 
   <thead> 
    <tr> 
     <th>Lo</th> 
     <th>Lorem ipsum </th> 
     <th class="infoh">Lore</th> 
    </tr> 
   </thead> 
   <tbody> 
    <tr> 
     <td>Lo</td> 
     <td class="name">Lorem</td> 
     <td class="info">Lorem ipsum dolor sit a</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials