Attribute selectors have specificity same as class selector and pseudoclass.


Here is W3's guide on Calculating a selector’s specificity:

Quting W3 guide here,

A selector’s specificity is calculated for a given element as follows:

count the number of ID selectors in the selector (= A)
count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= B)
count the number of type selectors and pseudo-elements in the selector (= C)
ignore the universal selector


*[type=radio] // 0-1-0

.class_name input[type="text"] { }  // 0-2-1


Leave a reply

Your email address will not be published. required fields are marked *