CSS 选择器优先级问题

复制代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        div.tc{ background-color:Orange;}
        .tc{ background-color: Black;}
        div
        {
            background-color: Red;
        }        
        #t1{ background-color:Purple;}
    </style>
</head>
<body>
    <div id="t1" class="tc">
        afdasfdsafd
    </div>
</body>
</html>
复制代码

得出的结论是: id > div.class > .class > div

posted on 2013-08-22 17:28  Gcam  阅读(111)  评论(0)    收藏  举报

导航

< 2025年6月 >
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 1 2 3 4 5
6 7 8 9 10 11 12
点击右上角即可分享
微信分享提示