CSS 後代選擇器


CSS 中的後代選擇器用於匹配所有指定元素的後代元素。

示例

你可以嘗試執行以下程式碼來實現 CSS 後代選擇器

動態演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         div p {
            background-color: orange;
         }
      </style>
   </head>
   <body>
      <div>
         <p>Para 1 in the div</p>
         <p>Para 2 in the div</p>
      </div>
      <p>Para 3 outside the div.</p>
   </body>
</html>

輸出

更新於:2020 年 06 月 22 日

253 次瀏覽

開啟你的職業生涯

完成課程並獲得認證

立即開始
廣告
© . All rights reserved.