HTML/CSS selection operator priority
CSS priority
1. By default, the same level style overwrites the former. 2. Style priority type (1) <class [type] (10) = pseudo class (10) <id (100) <style interline style (1000) <style internal style <link external introduced style selector values are combined to increase the priority. Note: The corresponding values only represent their levels, the priority of the 11 type delimiters is still less than one class delimiters, and so on. 3. important (IE7 and above) adds the important style attribute with the highest priority. Example
. Box {background: red! Important ;}
Test: Judge the priority of AB
A, # header # div1. box1 div. section p. link {..................}
B. # some. base # font # call {..................}
Method 1: A = 100 + 100 + 10 + 1 + 10 + 1 + 10 = 232B = 100 + 10 + 100 + 100 + 1 = 311 B> Method 2: AB kills two id delimiters each. A has no id delimiters, and B has another one. Therefore, B has A high priority. Answer: B