CSS Selector to select first and second table cells - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Cell

Description

CSS Selector to select first and second table cells

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 tr td:first-child {
   width:51px;
}

table tr td:last-child {
   width:151px;
}

td {<!--  w w w .j  a va  2s  .  co m-->
   background:gray;
}
</style> 
 </head> 
 <body> 
  <table> 
   <tbody> 
    <tr> 
     <td>Lorem ipsum dolor si</td> 
     <td>Lorem ipsum dolor sit</td> 
    </tr> 
    <tr> 
     <td>Lorem ipsum dolor sit ame</td> 
     <td>Lorem ipsum dolor sit amet</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials