liveleweekend
liveleweekend

Reputation: 181

Is it possible to wrap css subclasses under a single class?

Is it possible to wrap multiple subclasses somehow, e.g. html-wrapper style:

.class{
    .subclass1{
        /* rules */
    }
    .subclass2{
        /* rules */
    }
}

as opposed to:

.class .subclass1{
    /* rules */
}
.class .subclass2{
    /* rules */
}

It would make editing various elements on a single page much easier than constantly referring to the parent page/div, in the same way that @media{}does. Is this currently achievable?

Upvotes: 0

Views: 2326

Answers (1)

Sebastian Kaczmarek
Sebastian Kaczmarek

Reputation: 8515

It is not possible in pure CSS. However you can do this in CSS pre-processor, for instance Sass. You can read more about it here

Upvotes: 2

Related Questions