css和jquery子节点选择器




html
<div class="ranklist">
            <table class="list-table">
                <thead>
                    <tr class="list-table-head">
                        <th>排名</th>
                        <th>手机号码</th>
                        <th>盈利率</th>
                    </tr>
                </thead>
                <tbody>
                    <tr class="list-table-body">
                        <td>1</td>
                        <td>151****1111</td>
                        <td>20%</td>
                    </tr>
                    <tr class="list-table-body">
                        <td>2</td>
                        <td>151****2222</td>
                        <td>20%</td>
                    </tr>
                    <tr class="list-table-body">
                        <td>3</td>
                        <td>151****3333</td>
                        <td>20%</td>
                    </tr>
                    <tr class="list-table-body">
                        <td>5</td>
                        <td>151****9999</td>
                        <td>20%</td>
                    </tr>
                    <tr class="list-table-body">
                        <td>5</td>
                        <td>151****9999</td>
                        <td>20%</td>
                    </tr>
                </tbody>
            </table>
        </div>
jquery
    $(".list-table tbody tr:nth(0) td:nth(0)").html("");
    $(".list-table tbody tr:nth(1) td:nth(0)").html("");
    $(".list-table tbody tr:nth(2) td:nth(0)").html("");
css
.list-table tbody tr:nth-child(1) td:nth-child(1) {
    background-image: url("../image/psatlist/No-1.png");
    background-size: .58666667rem .72rem;
    background-position: center;
    background-repeat: no-repeat;   
}   
.list-table tbody tr:nth-child(2) td:nth-child(1) {
    background-image: url("../image/psatlist/No-2.png");
    background-size: .58666667rem .72rem;
    background-position: center;
    background-repeat: no-repeat; 
}
.list-table tbody tr:nth-child(3) td:nth-child(1) {
    background-image: url("../image/psatlist/No-3.png");
    background-size: .58666667rem .72rem;
    background-position: center;
    background-repeat: no-repeat; 
}
这样省掉了服务器端判断输出的数量这是出来做出的效果,jquery和css的选择器别弄混了,不然自己都蒙逼我是小白一个,别喷我。





猜你喜欢

转载自blog.csdn.net/King_flag/article/details/53930299