less-css — is it possible to get a parent's parent?
问题 Is it possible to get a parent's parent? I tried & & { } but that didn't work. I'm trying to style a child element based on it's grandparent. 回答1: Depends on Code Structure, and may Require Some Repetition of Code You cannot do it directly in most cases (see second example for exception). If Grandparent is an element This requires some repetition, but does allow for the grandparent to not be the outermost wrapper (so there could be a great grandparent). LESS grandparent { /* grandparent