Priority level:
1, add! The group of important rules enjoys the highest priority; will be all without! The rules of Important
For example: #id {border:6px solid black!important} above #id{border:6px solid black;}
2, the second level style property embedded rules are not easy to maintain this method is not recommended
3. Third level rule with one or more ID selectors
For example #id{border:9px solid red} has precedence higher than. ID{BORDER:9PX solid red;}
4. Fourth level priority grouping rules with one or more classes, attributes, or pseudo-class selectors
For example, CLASS{BORDER:9PX solid red} is higher than div{border:2px solid black;}
5, level fifth one or more element selector precedence rules
For example: div{border:10px solid red} above *{border:5px solid black;}
6, the sixth level refers to those rules that contain only wildcard selectors
For example: *{border:5px solid black;}
Note: If the rule belongs to the same selector group, such as the relevant two rules contain ID selectors, then their priority will be based on the type and number of selectors compared; that with more high priority then this selector level is high
(! Important >style> ID selector > class selector > Label/element selector > wildcard selector)
If the same number and level of selectors are present, the priority will be judged based on the location
Position Grouping Priority:
1. Top-Priority HTML Document header <style> elements
The <style> element overrides the rules introduced by the @import statement in the <style> element
2. @import imported styles in the <style> element override the style of the link element attachment
The 3.link style overrides the rules introduced by the link element in the style introduced by @import, which overrides the end-user attached style sheet
4, the link element introduced in the style of @import introduced in the end user attached style sheet rules
5. User-attached style sheet (note: The user-added @important style has the highest priority)
6. Default rules provided by the browser
CSS Stacking order