使用 CSS 選擇所有元素


要選擇所有元素,請使用 * CSS 選擇器。你可以嘗試執行以下程式碼來選擇所有元素,

示例

線上演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         *{
            color: blue;
            background-color: orange;
         }
      </style>
   </head>
   <body>
      <h1>Demo Website</h1>
      <h2>Learning</h2>
      <p id = "tutorials">Tutorials on web dev, programming, database, networking, etc.</p>
      <p>Every tutorials has lessons with illustrations and figures.</p>
   </body>
</html>

更新於: 2020 年 6 月 24 日

193 次瀏覽

開啟您的 職業 生涯

完成課程以獲得認證

開始
廣告
© . All rights reserved.