As far as I know, this is not possible since there is currently no parent selector in CSS , but you can use the jQuery $('ul:not(:has(ul))'); selector $('ul:not(:has(ul))'); for target ul without any child ul and add a class to them.
Example
source share