Priority CSS styles (weight)

When a different element selected by the selector and provided with the same pattern, then the conflict between the pattern generation

The final adoption of which selector?
The priority selector (weight) determined, the weight of the high display priority

Priority rules (by adding a plurality of positions):

  • Inline styles: Priority 1, 0,0,0
  • id selector: Priority 0,1,0,0
  • Classes and pseudo-classes: precedence 0,0,1,0
  • Element selector: Priority 0,0,0,1
  • Integration with Selector: priority 0,0,0,0
  • Inherited Styles: no priority
  • Plus the important styles:! Priority infinity

If the priority selector, like the style against the use (in order front, behind the front cover is a)

And set the priority selector are calculated separately

Inheritance rules:

  • Child elements can inherit the parent element style setting.
  • Not all child elements of style. Such as borders, height, etc. are not inherited.
  • Inheritance rules do not weight

Guess you like

Origin www.cnblogs.com/wbyixx/p/12071269.html