Selector in CSS differences [duplicate]

2

What's the difference between:

.figure-box>figure>img{
    width: 440px;
    position: relative;
}

To:

.figure-box figure img{
    max-width: 100%;
    position: relative;
    transition: transform 0.6s;
}
    
asked by anonymous 25.04.2017 / 19:48

2 answers

0

.A>.B>.C will select C which is the immediate child of B that is the immediate child of A

.A .B .C will select C and B for any descendants

    
25.04.2017 / 19:58
0

The difference is that with > means that the element has to be direct child, eg:

<div class="figure-box">
   <div><div><div><div>
      <figure>
         <div>
            <img src=""/>
         </div>
      </figure>
   </div></div></div></div>
</div>

For this HTML trait, .figure-box figure img , but .figure-box > figure > img , because figure is not a direct child of .figure-box

And for selector without > , this condition of direct child is independent

    
25.04.2017 / 20:00