html - less: how to match only those <li> with <ul> children -
this question has answer here:
- add rule element if has child 2 answers
i have nested list , want less match <li> lines have <ul> sub-lists.
for example in following list want match cats, devious , dogs, not playful, destructive, deadly, fast , smart.
<ul> <li>cats <ul> <li>playful</li> <li>devious <ul> <li>destructive</li> <li>deadly</li> </ul> </li> </ul> </li> <li>dogs <ul> <li>fast</li> <li>smart</li> </ul> </li> </ul> how do that?
that's not possible in css or less, if can use jquery, this:
$("li"):has("ul,li").addclass('childclass');
hope helps!
Comments
Post a Comment