CSS :first-child pseudo-class simple example - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:first-child

Description

CSS :first-child pseudo-class simple example

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <style>
p .field:first-child {
   color:Chartreuse;
}
</style> <!--   w  ww  . jav  a2s  .  c  o m-->
 </head> 
 <body translate="no"> 
  <p> <span class="field">first - should be red</span> <span class="field">second</span> </p>  
 </body>
</html>

Related Tutorials