D
D
Demigodd2019-01-19 21:12:10
Less
Demigodd, 2019-01-19 21:12:10

How to write nested elements correctly in less?

For example, there is such a code.

<div class="header">
  <div class="header__name">
  </div>
</div>

.header {
    // code..

  @include element('name') {
    // code..
  }
}

Does this syntax work in less ? Or only in sass?
How to get a nested class so that it can be used as
element → header__name, or modifier → header--name ?
In general, I don’t want to write two classes separately, but I want to link them so that the syntax turns out like this header_name . How to do it ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
skuvaWeb, 2019-01-19
@Demigodd

It is most likely done like this:

.header{
  &--red{

  }
  &__name{
  
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question