Style failure caused by CSS priority selection, css priority Style
Style invalidation caused by the priority of the separator:
Because the CSS selection operator priority may cause some styles to fail, this problem may be encountered by beginners, but it is often not easy to find.
Code example:
<! DOCTYPE html>
The above code sets all text in the li element to green. At this time, the requirement may change. To use the first li element as the title, you need to change its element.
The Code is as follows:
<! DOCTYPE html>
Although the class is set separately for the first li element and the new color is specified, it does not take effect. This is caused by the priority of the selector.
You only need to modify the CSS Code as follows:
.mydiv li{color:green;} .mydiv .myli{color:blue;}
For details about the priority rules of selector, refer to the section CSS selector Priority 1.
Original address: http://www.51texiao.cn/div_cssjiaocheng/2015/0519/1894.html
The original address is: http://www.softwhy.com/forum.php? Mod = viewthread & tid = 4701.