0

Can we do nested CSS statements? Instead of repeating classes like:

.hello .world1 {}
.hello .world2 {}

We do something like:

.hello {
   .world1 {}
   .world2 {}
}

Is similar thing possible in CSS/CSS3?

Henrik Petterson
  • 6,776
  • 19
  • 65
  • 144

2 Answers2

1

It is not possible in CSS but you could do that using SASS.

aMJay
  • 2,066
  • 5
  • 22
  • 32
0

You could combine child elements using: Child Selector

The child selector selects all elements that are the immediate children of a specified element.

The following example selects all "p" elements that are immediate children of a element:

Example:

div > p {
    background-color: yellow;
} 
Dsenese1
  • 1,056
  • 10
  • 18