使用 CSS 重置所有属性

cssweb developmentfront end technology更新于 2025/7/16 22:36:17

使用 all 属性重置所有属性。将 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>

相关文章


有用资源