Calculate CSS selector specificity instantly. Understand selector weight, priority scores, and resolve Стиль conflicts. Enter any CSS selector to see its specificity Значение Вход (a,b,c) format. Бесплатно and на стороне клиента.
The CSS Specificity Калькулятор helps developers understand and compare the weight из CSS selectors. CSS specificity determines which styles apply when multiple rules Цель the same element. The Калькулятор breaks down any selector into its component parts — Строчный styles, IDs, classes/attributes/pseudo-classes, and elements/pseudo-elements — and computes the (a,b,c) specificity Значение. Understanding specificity is essential for debugging CSS conflicts and writing maintainable stylesheets.
CSS specificity is the algorithm browsers use to decide which CSS property values are applied to an element when multiple rules could apply. It is calculated as a tuple из three values (a, b, c): a = number из ID selectors, b = number из class selectors + attribute selectors + pseudo-classes, c = number из element selectors + pseudo-elements.
Specificity is calculated by counting the number из each selector Тип Вход a selector string: (a) ID selectors (#id), (b) class selectors (.class), attribute selectors ([attr]), and pseudo-classes (:Наведение), and (c) element selectors (div) and pseudo-elements (::Перед). The !important declaration overrides specificity entirely.
An ID selector (#id) always outranks any number из class selectors because specificity is Не a base-10 number — it is a tuple. (1, 0, 0) is always greater than (0, 100, 0). Нет amount из classes can beat a single ID.
Нет, the universal selector (*) has zero specificity and does Не contribute to the specificity calculation.