In CSS3 you have:
:nth-last-child(2)
See: https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-last-child
nth-last-child Browser Support:
- Chrome 2
- Firefox 3.5
- Opera 9.5, 10
- Safari 3.1, 4
- Internet Explorer 9
More Related Contents:
- Understanding CSS selector priority / specificity
- CSS Pseudo-classes with inline styles
- CSS negation pseudo-class :not() for parent/ancestor elements
- How can I select the last element with a specific class, not last child inside of parent?
- Are class names in CSS selectors case sensitive?
- Why doesn’t table > tr > td work when using the child selector?
- CSS selector by inline style attribute
- :last-child not working as expected?
- Using CSS :before and :after pseudo-elements with inline CSS?
- Using :before and :after CSS selector to insert HTML [duplicate]
- What is the performance impact of the universal selector?
- Why is nth-child selector not working?
- CSS selector with period in ID
- Can a ::before selector be used with a ?
- Is it possible to use CSS vars in CSS3 selectors?
- What is the ::content/::slotted pseudo-element and how does it work?
- CSS Selector “(A or B) and C”?
- Why does the general-sibling combinator allow toggling pseudo-element’s content, but not the adjacent-sibling?
- How to get CSS to select ID that begins with a string (not in Javascript)?
- How do I select an element that has a certain class?
- Selecting the last element among various nested containers
- Zebra striping a flexbox table with wrapping items
- CSS attribute selector does not work a href
- How to use nth-child for styling with a table with rowspan?
- CSS Selector for No-Children-But-Not-Empty
- Is there a CSS not equals selector?
- How to select classes with spaces
- CSS nth-match doesn’t work
- How can I select elements in CSS by partial ID value?
- Targeting text nodes with CSS