I am getting red background-color for both h1. For the first h1, ID has the highest precedence and for the second h1, the inline has the highest precedence. Why?
#myid { background-color: pink; } .main h1 { background-color: red; } div h1 { background-color: blue; } h1 { background-color: green; } <!-- the background-color expected to be pink for the following h1 --> <div class="main" id="myid"> <h1>This is paragraph one!</h1> </div> <!-- the background-color expected to be brown for the following h1 --> <div style="background-color:brown;" class="main" > <h1>This is paragraph two!</h1> </div>