<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                語法: :nth-child(an+b) 下面就把CSS3標準中nth-child()用法大致介紹給大家: ## CSS3偽類選擇器:nth-child() ## 簡單的歸納下nth-child()的幾種用法。 ## 第一種:簡單數字序號寫法 :nth-child(number) 直接匹配第number個元素。參數number必須為大于0的整數。 例子: li:nth-child(3){background:blue;} ## 第二種:倍數寫法 :nth-child(an) 匹配所有倍數為a的元素。其中參數an中的字母n不可缺省,它是倍數寫法的標志,如3n、5n。 例子: li:nth-child(3n){background:red;} ## 第三種:倍數分組匹配 :nth-child(an+b) 與 :nth-child(an-b) 先對元素進行分組,每組有a個,b為組內成員的序號,其中字母n和加號+不可缺省,位置不可調換,這是該寫法的標志,其中a,b均為正整數或0。如3n+1、5n+1。但加號可以變為負號,此時匹配組內的第a-b個。(其實an前面也可以是負號,但留給下一部分講。) 例子: li:nth-child(3n+1){background:red;} li:nth-child(3n+5){background:blue;} li:nth-child(5n-1){background:yellow;} li:nth-child(3n±0){background:green;} li:nth-child(±0n+3){background:orange;} ## 第四種:反向倍數分組匹配 :nth-child(-an+b) 此處一負一正,均不可缺省,否則無意義。這時與:nth-child(an+1)相似,都是匹配第1個,但不同的是它是倒著算的,從第b個開始往回算,所以它所匹配的最多也不會超過b個。 例子: li:nth-child(-3n+8){background:red;} li:nth-child(-1n+8){background:blue;} ## 第五種:奇偶匹配 :nth-child(odd) 與 :nth-child(even) 分別匹配序號為奇數與偶數的元素。奇數(odd)與(2n+1)結果一樣;偶數(even)與(2n+0)及(2n)結果一樣。 作者觀點:表格奇偶數行定義樣式就可以寫成 .table > tr:nth-child(even) > td {background-color: #f00;} (偶數行) .table > tr:nth-child(odd) > td {background-color: #c00;} (奇數行) jQuery中用此方法可以實現條紋效果: $("table tr:nth-child(even)").addClass("hangbg"); even 可以換成別的參數,上面介紹的五種情況都可以。 后面的addClass("hangbg") hangbg 是個CSS class名稱。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看