使用CSS重置所有屬性


使用 all 屬性可重置所有屬性。將所有屬性設定為 initial、inherit 或 unset。

示例

你可以嘗試執行以下程式碼來實現 CSS all 屬性

現場演示

<!DOCTYPE html>
<html>
   <head>
      <style>
         html {
            color: blue;
         }
         #demo {
            background-color: yellow;
            color: red;
            all: inherit;
         }
      </style>
   </head>
   <body>
      <h2>CSS all property</h2>
      <div id = "demo">This is demo text.</div>
   </body>
</html>

更新於:2020-07-06

596 次瀏覽

開啟你的職業生涯

透過完成課程獲得認證

開始學習
廣告
© . All rights reserved.