08权重精华题.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> #fa #son { color: blue; } #fa p.c2 { color: black; } #fa{ color: red!important; /* 继承权重为0*/ } </style> </head> <body> <div id="fa" class="c1"> <p id="son" class="c2">猜猜我啥颜色</p> </div> </body> </html>
09权重精华题2.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> #fa { color: red; } p { color: green; } </style> </head> <body> <div id="fa"> <p>猜猜我啥颜色</p> </div> </body> </html>
10权重精华题3.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> /*0 0 2*/ div p { color: red; } #fa { color: green; } /*0 1 1*/ p.c2 { color: blue; } </style> </head> <body> <div id="fa" class="c1"> <p id="son" class="c2">猜猜我啥颜色</p> </div> </body> </html>