ProtectedVoid
ProtectedVoid

Reputation: 1315

CSS Less - Define a class encapsulated in other class

This is what I need to achieve with CSS Less: I need define a class encapsulated in other class.

CSS

.class1{ . . .}
.class1 .class2{ . . .}

LESS

In Less I know how to define this:

.class1{&.class2{. . .}} 

But this is equal to this

.class1{}
.class1.class2{}

How can I define the first CSS example with Less?

Upvotes: 0

Views: 238

Answers (1)

Matt S
Matt S

Reputation: 15364

Simply leave out the &, which references the parent selector.

.class1{
    .class2{. . .} 
} 

Upvotes: 5

Related Questions