<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ## :first-child 偽元素 ### 定義和用法 :first-child選擇器匹配第一個子元素。 :first-child是一個偽類,它適用于任何元素,它是另一個元素的第一個子元素。 使用:first-child偽類,一個元素只有當它是另一個元素的第一個子元素時才匹配。例如,p:first-child將選擇作為某個其他元素的第一個子元素的任何p元素。如果要選擇段落的第一個子元素,我們可以使用p>\*:first-child。 **例子:** ~~~ body *:first-child {font-weight: bold;} p:first-child {font-size: 125%;} ~~~ ## 實例--匹配屬于父元素中第一個子元素的每個元素 ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>W3Cschool教程(w3cschool.cn)</title> <style> p:first-child { background-color:yellow; } </style> </head> <body> <p>This paragraph is the first child of its parent (body).</p> <h1>Welcome to My Homepage</h1> <p>This paragraph is not the first child of its parent.</p> <div> <p>This paragraph is the first child of its parent (div).</p> <p>This paragraph is not the first child of its parent.</p> </div> <p><b>注意:</b> :first-child作用于 IE8以及更早版本的瀏覽器, DOCTYPE必須已經聲明.</p> </body> </html> ``` ## 實例2--元素是其父級的第一個子元素,每個元素的 元素的樣式: ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>W3Cschool教程(w3cschool.cn)</title> <style> p:first-child i { background:yellow; } </style> </head> <body> <p>I am a <i>strong</i> man. I am a <i>strong</i> man.</p> <p>I am a <i>strong</i> man. I am a <i>strong</i> man.</p> <p><b>注意:</b> :first-child作用于 IE8以及更早版本的瀏覽器, DOCTYPE必須已經聲明.</p> </body> </html> ``` ## 實例3--列表中的第一個 元素選擇的樣式: ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>W3Cschool教程(w3cschool.cn)</title> <style> li:first-child { background:yellow; } </style> </head> <body> <ul> <li>Coffee</li> <li>Tea</li> <li>Coca Cola</li> </ul> <ol> <li>Coffee</li> <li>Tea</li> <li>Coca Cola</li> </ol> <p><b>注意:</b> :first-child作用于IE8以及更早版本的瀏覽器, DOCTYPE必須已經聲明</p> </body> </html> ``` ## 實例4--每一個元素的第一個子元素選擇的樣式:: ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>W3Cschool教程(w3cschool.cn)</title> <style> ul>:first-child { background:yellow; } </style> </head> <body> <ul> <li>Coffee</li> <li>Tea</li> <li>Coca Cola</li> </ul> <ul> <li>Coffee</li> <li>Tea</li> <li>Coca Cola</li> </ul> <p><b>注意:</b> :first-child作用于 IE8以及更早版本的瀏覽器, DOCTYPE必須已經聲明.</p> </body> </html> ```
                  <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>

                              哎呀哎呀视频在线观看