css - Which selector will apply for HTML tag -
this question has answer here:
<style>      .divnav      {         font-size:25px;       }       #divnav      {         font-size:25px;       } </style>  <div class="divnav" id="divnav"> both id , class have same style.
which apply? , reason?
it apply id style. because id have high specificity .
check:
#divnav         {          font-size:25px;          }  .divnav         {          font-size:15px;          }        <div class="divnav" id="divnav">test</div>and:
.divnav         {          font-size:15px;          }          #divnav         {          font-size:25px;          }<div class="divnav" id="divnav">test</div>
Comments
Post a Comment