请老师检查!

请老师检查!

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>:nth-child()</title>

    <style type="text/css">

        /*此处补充样式*/

        thead tr:first-child{background:#ff0;}

        tbody tr:nth-child(2n+1){color:orange;}

        tbody tr:nth-child(2n){color:#0f0;}

    </style>

</head>

<body>

    <table border="1" cellspacing="0" width="200">

        <thead>

            <tr>

                <th>序号</th>

                <th>姓名</th>

                <th>性别</th>

                <th>年纪</th>

            </tr>

        </thead>

        <tbody> 

            <tr>

                <td>1</td>

                <td>张三</td>

                <td>男</td>

                <td>12</td>

            </tr>

            <tr>

                <td>2</td>

                <td>李四</td>

                <td>女</td>

                <td>11</td>

            </tr>

            <tr>

                <td>3</td>

                <td>赵五</td>

                <td>男</td>

                <td>12</td>

            </tr>

            <tr>

                <td>4</td>

                <td>王二</td>

                <td>男</td>

                <td>12</td>

            </tr>

        </tbody>  

    </table>

</body>

</html>


正在回答

登陆购买课程后可参与讨论,去登陆

1回答

同学你好,代码实现效果很棒!

另外,练习中要求使用选择器为

http://img1.sycdn.imooc.com//climg/5f6d52eb09d2f8ac03300029.jpg

代码中使用的是表达式,也是可以的,但是建议按照要求来写哦。

祝学习愉快!

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师