Edit This Code:
<!DOCTYPE html>
<html>
<head>
<style>
li:first-child {
    background: yellow;
}

</style>
</head>
<body>

<ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Coca Cola</li>
</ul>

<ol>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Coca Cola</li>
</ol>

<p><b>Note:</b> For :first-child to work in IE8 and earlier, a DOCTYPE must be declared.</p>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy