css3学习下...

a[href^="http:"]{}//所有以http开头的href元素

a[href$="pdf"]{}//所有以pdf结尾的href元素

a[href*="xxx"]{}//所有包含xxx内容的href元素

 <style>

    a[href^="http:"]{

         background:url("images/rar.png") no-repeat left center; 

        background-color: #dddddd;

        border:2px dotted;

    }

    a[href$="word.com"]{

        background: url("images/word.png") no-repeat left center;

        padding-left: 18px;;

    }

    a[href$="pdf.com"]{

        background: url("images/pdf.png") no-repeat left center;

        padding-left: 18px;;

    }

    a[href$="rar.com"]{

        background: url("images/rar.png") no-repeat left center;

        padding-left: 18px;;

    }

    a[href*="com"]{

        color: green;

    }

     全局 同body 

     :root{}

    tr:nth-child(odd)

    tr:nth-child(even)

    odd = 2n even = 2n+1 一奇一偶 

    倒数第二个 

    tr:nth-last-child(2){} 

    tr:nth-of-type(3){} 

    th:nth-of-type(3){} 

    td:nth-of-type(3){}

    td:last-child{} 

    td:first-of-type{}

    td:last-of-type{} 

    只有一个td的行 

    td:only-child{}

    td:only-of-type{}

    td:empty{}

    </style>

<body>


<p><a href="http://www.pdf.com">http://www.pdf.com</a></p>
<p><a href="http://www.rar.com">http://www.rar.com</a></p>
<p><a href="http://www.word.com">http://www.word.com</a></p>
<p><a href="http://www.pdf.com">http://www.pdf.com</a></p>
<p><a href="http://www.rar.com">http://www.rar.com</a></p>
<p><a href="http://www.word.com">http://www.word.com</a></p>
<table>
    <tr><th>111</th><th>34444</th><th>333</th></tr>
    <tr><td>11111111111</td><td>22222222222222</td><td>33333333333333</td></tr>
    <tr><td>444444</td><td>55</td><td>66</td></tr>
    <tr><td>11111111111</td><td>22222222222222</td><td>33333333333333</td></tr>
    <tr><td>1</td><td>222222221222222</td><td>333333334333333</td></tr>
    <tr><td>111112111111</td><td>222222222222222</td><td>3333343333333333</td></tr>
    <tr><td>11111111111</td><td>22222222222222</td><td>33333333333333</td></tr>
</table>

</body>

原文地址:https://www.cnblogs.com/doublegi/p/5747967.html