css - LESSCSS check if closest parent has class -
i use:
.first{ .second{ .third{ .between_second_and_third & { /* rules */ } } } } and in end have:
.between_second_and_third .first .second .third {/* rules */} but want:
.first .second .between_second_and_third .third {/* rules */} how can it?
first, & marker refer current parent selector (as mentionned here)
that's why you've got final statement cause defined that:
.first{ .second{ .third{ .between_second_and_third .first .second .third { /* rules */ } } } you have nest between_second_and_third class between... .second , .third class declarations this:
.first{ /* first rules */ .second{ /* rules second */ .between_second_and_third { /* rules between */ .third{ /* other rules */ } } } this declaration render lines of css code:
.first { /* first rules */ } .first .second { /* rules second */ } .first .second .between_second_and_third {/* rules between */} .first .second .between_second_and_third .third {/* other rules */}
Comments
Post a Comment