title: How do I select the "last child" with a specific class name in CSS?
body: <pre><code>&lt;ul&gt;
      &lt;li class="list"&gt;test1&lt;/li&gt;
      &lt;li class="list"&gt;test2&lt;/li&gt;
      &lt;li class="list"&gt;test3&lt;/li&gt;
      &lt;li&gt;test4&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>How do I select the "last child" with the class name: <strong>list</strong>?</p>
  
  <pre><code>&lt;style&gt;
      ul li.list:last-child{background-color:#000;}
  &lt;/style&gt;
  </code></pre>
  
  <p>I know the example above doesn't work, but is there anything similar to this that does work?</p>
  
  <p><strong>IMPORTANT:</strong></p>
  
  <p>a) I can't use <code>ul li:nth-child(3)</code>, because it could happen that it's on the fourth or fifth place too.</p>
  
  <p>b) No JavaScript.</p>