How to style only the first item in a list


 To achieve this we have to deploy the child selector like so.

<ul>
  <li>red </li>
  <li>blue </li>
  <li>green</li>
</ul>

CSS: 

<style>
 li:first-child{color: red;}
</style>

Comments

Popular posts from this blog

How CSS3 Works