8

I am trying to use LESS CSS to write my CSS but i got a problem with nested pseudoclasses I

.class1 { 
        &:nth-of-type(2n) {  
            .class2{  
            } 
        } 
    }

the output is:

.class1.class2:nth-of-type(2n) {}

but I want to have this:

.class1:nth-of-type(2n) .class2{}

Any ideas?

1
  • 2
    That snippet already gives .class1:nth-of-type(2n) .class2 for me. Commented Aug 5, 2011 at 11:09

1 Answer 1

3

Not an issue. You probably had a version of LESS CSS that did not produce the correct code. Try the online less converter and see that it works fine. Here is what I get:

(in)

.class1 { 
  &:nth-of-type(2n) {  
    .class2{  
      x:1;
    } 
  } 
}

(out)

.class1:nth-of-type(2n) .class2 {
  x: 1;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.