What is the difference between nesting of selectors with and without a space? .selector1.selector2 / .selector1 .selector2

    2 answers 2

    .selector1.selector2 - elements with two classes selector1 and selector2 (and possibly others)

    .selector1 .selector2 - elements with class selector2 somewhere inside elements with class selector1

      In the first case, it will look like:

       <div class="selector1 selector2"></div> 

      In the second:

       <div class="selector1"> <div class="selector2"></div> </div> 

      If you write selectors without spaces, it will be one component with several classes. If with spaces, then this is an nesting of elements.