1. priority selector
! important> Inline selector (style)> id selector> class selector | attribute selector | pseudo class selector> element selectors> wildcard (*)
2. Select the device weight (weight calculation can avoid many problems by rights)
!important | 10000 |
Inline selector | 1000 |
id selector | 100 |
Class selector | 10 |
Element selector | 1 |
eg: body #sum {width: 100px;} Results: 100 + 1 = 101.
ps :! important at some point will fail (of course can not! imortant not use)
eg:box{
width:100px!important;
min-width:200px;
}
at this time! important fail, the final width will be 200px.