码迷,mamicode.com
首页 > 其他好文 > 详细

demo_07选择器练习

时间:2016-07-05 12:11:59      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title></title>
        <style type="text/css">
        body{
            background-color: #bbc;
        }
        header{
            width: 100%;
            text-align: center;
            height: 50px;
            margin-top: 20px;
            line-height: 50px;
            font-family: "微软雅黑";
            font-size: 25px;
            color: #DDFFFF;
            letter-spacing: 2px;
        }
        table{    
            margin: 100px auto;
        }
            table td{
                width: 100px;
                height: 30px;
                text-align: center;
                color: #333;
            }
            tr:first-child{
                background-color: #ddd;
            }
            tr:nth-last-child(2){
                background-color: #def;
            }
            tr:nth-child(2){
                background-color: #fde;
            }
            tr:nth-child(3){
                background-color: #dff;
            }
            tr:last-child{
                background-color: #fbc;
            }
            td:nth-last-child(4){
                background-color: #bcf;
            }
            tr:nth-child(2)>td:nth-child(2){
                background-color: #dbf;
            }
            tr:nth-child(4) td:nth-child(3){
                background-color: #bac;
            }
            td[style]{
                background-color: #dac;
            }
            td[class~="name"]{
                background-color: #efadcb;
            }
            td[class*="set"]{
                background-color: #defacb;
            }
            td[class*="set"]+td+td{
                background-color: #3d21bc;
            }
        </style>
    </head>
    <body>
        <header>
            CSS3选择器练习
        </header>
        <section>
            <table cellpadding="0" cellspacing="3">
                <tr>
                    <td>11</td>
                    <td class="name set">12</td>
                    <td>13</td>
                    <td>14</td>
                    <td>15</td>
                    <td>16</td>
                    <td>17</td>
                </tr>
                <tr>
                    <td>21</td>
                    <td>22</td>
                    <td>23</td>
                    <td>24</td>
                    <td>25</td>
                    <td class="name">26</td>
                    <td>27</td>
                </tr>
                <tr>
                    <td>31</td>
                    <td>32</td>
                    <td>33</td>
                    <td class="name">34</td>
                    <td>35</td>
                    <td>36</td>
                    <td>37</td>
                </tr>
                <tr>
                    <td>31</td>
                    <td>32</td>
                    <td>33</td>
                    <td>34</td>
                    <td>35</td>
                    <td>36</td>
                    <td style="">37</td>
                </tr>
                <tr>
                    <td>31</td>
                    <td>32</td>
                    <td>33</td>
                    <td>34</td>
                    <td>35</td>
                    <td>36</td>
                    <td>37</td>
                </tr>
            </table>
        </section>
    </body>
</html>

 

demo_07选择器练习

标签:

原文地址:http://www.cnblogs.com/wmwPro/p/5642903.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!