0

css not work enter image description here enter image description here

i hope the .a class first color will be red , but not work .

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

<body>
  <ul>
    <li>0</li>
    <li title="1" class="a">1</li>
    <li title="2" class="a">2</li>
    <li title="3" class="a">3</li>
    <li>4</li>
  </ul>
</body>
technophyle
  • 7,972
  • 6
  • 29
  • 50
Peppa Pig
  • 11
  • 1
  • but how to select class = a and first . – Peppa Pig Aug 21 '23 at 03:19
  • i hope
  • 1
  • is red – Peppa Pig Aug 21 '23 at 03:22
  • I know what you want, but I don't think it's possible with what you have – Jaromanda X Aug 21 '23 at 03:23