CSS 位置:固定;

cssweb developmentfront end technology更新于 2024/5/25 6:36:17

position:fixed; 属性允许您相对于视口定位元素。您可以尝试运行以下代码来实现 CSS 位置:固定;

示例

<!DOCTYPE html>
<html>
   <head>
      <style>
         div{
            position: fixed;
            bottom: 0;
            right: 0;
            width: 200px;
            border: 3px solid blue;
         }
      </style>
   </head>
   <body>
      <h2>position: fixed;</h2>
      <p>The position: fixed; property allows you to position element relative to the viewport.</p>
      <div>
         div has position: fixed;
      </div>
   </body>
</html>

输出


相关文章


有用资源