calc() CSS 函数的用法

cssweb developmentfront end technology更新于 2024/9/20 22:36:17

使用 calc() 属性获取 CSS 中的属性值。您可以尝试运行以下代码在 CSS 中实现 calc() 函数

示例

<!DOCTYPE html>
<html>
   <head>
      <style>
         #demo {
            position: absolute;
            width: calc(100% - 100px);
            background-color: blue;
            text-align: center;
         }
      </style>
   </head>
   <body>
      <h1>Heading One</h1>
      <div id = "demo">This is it!</div>
   </body>
</html>

相关文章


有用资源