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,862
  • 20
  • 71
  • 155

2 Answers2

1

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

aMJay
  • 2,215
  • 6
  • 22
  • 34
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,106
  • 10
  • 18