全選

內部元素

使用 CSS 選擇元素


使用元素 元素選擇器選擇另一元素內部的所有元素。

你可以嘗試執行以下程式碼來實現元素 元素選擇器,

示例

即時演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         div p {
            color: white;
            background-color: blue;
         }
      </style>
   </head>
   <body>
      <h1>Demo Website</h1>
      <h2>Fruits</h2>
      <p>Fruits are good for health.</p>
      <div>
         <p>This is demo text.</p>
      </div>
   </body>
</html>

更新於: 2020 年 6 月 24 日

3000+ 瀏覽次數

開啟你的職業生涯

完成本課程獲取認證

開始
廣告
© . All rights reserved.