Why can not call CSS "cast" classes

1

Why can not I call "pasted" classes like this:

.div1.div2.div3 {
   blablabla;
}

I can only do this:

.div1 .div2 .div3{
   blablabla
}

I would like to know the difference.

    
asked by anonymous 02.06.2017 / 16:29

1 answer

3

From the first mode:

.div1.div2.div3 {
   blablabla;
}

You are selecting an element that has all three classes, as follows:

<div class="div1 div2 div3"></div>

In the second case you are working with the following structure:

<div class="div1">
  <div class="div2">
    <div class="div3">
      ...
    </div>
  </div>
</div>

That is, div1 > div2 > div3, in relation to inheritance. Selecting the .div3 child element of the .div2 child element of the .div1 element.     

02.06.2017 / 16:35