New pseudoclasses are opening new horizons for CSS/HTML coders. Most of the features like first-child
, last-child
, and nth-child
, were added with JavaScript code. For example, using jQuery code, you could get a list element and add specific classes to the first/last/nth element, and then to properly create a selector, you could add a CSS code.
But when it is natively supported by a browser, it is better to use CSS. Let's gather basic knowledge about this feature.