-1

I'm trying to add the same styling to multiple classes, including a nested SASS class like so

  .class1,
  .class2,
  .class3,
  .class4.class4child,
  .class5 {
    background: #FFF;
    padding: 3.2rem;
    border-radius: 0.8rem;
  }

I'm hoping class4.class4child will inherit these properties, but this implementation doesn't seem to work. (class1,2,3,5 all work here)

edit: Not a duplicate of this question, as I was not aware of both syntax.

Grambam
  • 424
  • 1
  • 3
  • 17

1 Answers1

2

Replace

 .class4.class4child,

which only applies to elements that have both classes, with

 .class4 .class4child,

which applies to elements with class="class4child" which are descendants to an element with class="class4".

connexo
  • 53,704
  • 14
  • 91
  • 128