Attribute selectors have specificity same as class selector and pseudoclass.

0-1-0

Here is W3's guide on Calculating a selector’s specificity: https://www.w3.org/TR/selectors/#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

Examples


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

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

0 Comments

Leave a reply

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