CSS- weight

CSS weights

Refers to the weight CSS style priority, there are two or more pattern acting on an element, the high weight of the piece of style element to work, the same weight, the writing style overrides and writing style.

Weight-grade

Bar style application mode can be divided into several levels, according to the rank to calculate the weights.

  1. ! Important, added after the style property values, the weight is 10000
  2. Inline style, such as: style = "" weight value 1000
  3. ID selector, such as weight value 100 #content
  4. Classes, attributes, and pseudo-class selectors, such as: content, hover weighted value of 10
  5. Tag pseudo-element selector and selection, such as: div, p, before weight value is 1
  6. Universal selector (*), the child selector (>), adjacent selector (+), fellow selector (~) weight value 0

Guess you like

Origin www.cnblogs.com/i969639/p/11201154.html