CSS selector to get deepest element of specific class in the HTML tree

You can use the jQuery selector .rowsLayout:not(:has(.rowsLayout)).

However, for performance reasons, this is not possible in CSS.

Your selector depends on the children (or lack thereof) of the elements that you target.
CSS is designed so that an element’s selectors can always be resolved before the element’s children exist; this allows CSS to be applied as a document loads.

Leave a Comment