0

This is my HTML code.

<div class="app-menu-layout">
  <main class="app-menu-layout-main">
    <div class="app-menu-layout-main-container">Hello World</div>
  </main>
</div>

Here's what I did, but he was wrong

.app-menu-layout {
  &>&-main {
    &>&-container{
      color:red
    }
  }
}


// Compiled CSS
.app-menu-layout>.app-menu-layout-main>.app-menu-layout>.app-menu-layout-main-container {
  color: red;
}

expected results:

.app-menu-layout>.app-menu-layout-main>.app-menu-layout-main-container {
  color: red;
}

How should I write the nested structure of less?

user15163984
  • 459
  • 2
  • 8

1 Answers1

0

Just write the correct class names. e.g

.app-menu-layout {
   &.app-menu-layout-main {
      &.app-menu-layout-main-container{
        color:red;
       }
    }
 }

Link to nested LESS.

samargy_
  • 33
  • 1
  • 6