首页 > 关于css的优先级,怎样才能让第二个a应用current的样式?

关于css的优先级,怎样才能让第二个a应用current的样式?

样式:
<style type="text/css">
    .img-con li a{
        width: 20px;
        height: 20px;
        border-radius: 20px;
        background: rgb(255,255,255);
        display: block;
        float: left;
        margin-left: 30px;
        border: 1px solid rgba(25,25,25,0.6);
    }
    .current{
        background-color: rgba(30,30,30,0.3);
    }
</style>
内容:
<body>
    <ul class="img-con">
        <li><a href="#"></a></li>
        <li><a href="#" class="current"></a></li>
        <li><a href="#"></a></li>
    </ul>
</body>

.img-con li a.current这样不就ok了


1、统一属性名:你.img-con li a用的是background.currentbackground-color
2、如果1方法还没有效果在.current的属性后加!important

【热门文章】
【热门文章】