0

The nested class in CSS

.wrapper .widecolumn {
    width: 983px;
}

could be repersented in SCSS as

.wrapper {
    .widecolumn {
        width: 983px;
    }
}

but how to represent this?:

.wrapper.widecolumn {
    width: 983px;
}
Paul
  • 25,812
  • 38
  • 124
  • 247

2 Answers2

5
wrapper.widecolumn {
    width: 983px;
}

is fine (assuming here that wrapper is an example tag). If you're just concerned about nesting, use & like so:

wrapper {
    &.widecolumn {
        width: 983px;
    }
}

The & represents the parent object, so you can also do clever things like

wrapper {
    &.widecolumn {
        width: 983px;
    }
    &:hover {
        color: red;
    }
    body.mycoolclass & {
        font-weight: bold;
    }
}
moopet
  • 6,014
  • 1
  • 29
  • 36
-3

You can do Also

.wrapper {
    
  &__widecolumn {
        width: 983px;
    }
  
}

When you will do that then you can simply use This just like that :

<div class="wrapper__widecolumn">

  <!-- This Column will be 983px -->

  
</div>
Piotr Sikora
  • 145
  • 9