I'm wondering what the specificity of the attribute selector is. For example:
- Id = 100 points
- Class = 10 points
- Html Tag= 1 point
Example:
/* this specificity value is 100 + 10 + 1 = 111 */
#hello .class h2 { }
With this HTML:
<div class="selectform">
<input type="text" value="inter text">
<input type="text" value="inter text" class="inputag">
</div>
Which of these 2 selectors is more specific?
.selectform input[type="text"] { }
.selectform .inputbg { }
Check to demo http://tinkerbin.com/IaZW8jbI
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…