權重的取值:html
按照 id class 標籤 的順序在其位置上標出1或者0spa
例以下面的例子code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> /*權重:數數 id class 標籤*/ /*100*/ #box{ width:200px; height:200px; background-color: red; } /*010*/ .box{ width:200px; height:200px; background-color: green; } /*001*/ div{ width:200px; height: 200px; background-color: blue; } </style> </head> <body> <div id="box" class="box"></div> </body> </html> /*最終的顏色爲red*/