A CSS rule overrides the rules that come before it in the style sheet. That is why the color displayed is red in the following example.
.two {
    background-color: blue;
}
.two {
    background-color: red;
}
<div class="one">
    Hello
    <div class="two"> World! </div>
</div>
Why in the next example the color is blue?
.one .two {
    background-color: blue;
}
.two {
    background-color: red;
}
<div class="one">
    Hello
    <div class="two"> World! </div>
</div>
 
     
    