I am looking for a css selector that lets me select the pre-last child of list.
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li> <!-- select the pre last item dynamically no matter how long this list is -->
<li>6</li>
</ul>
Static method:
ul li:nth-child(5)
Dynamic method:
ul li:last-child(-1)
which of course doesn’t validate, also nth-last-child doesn’t seem to provide a dynamic way.. I can fallback to javascript but I’m wondering if there is a css way I overlooked