mickeyort 发表于 2020-3-23 13:44:04

CSS 固定定位 position fixed


简单描述:固定定位是将某个元素固定在浏览器的某个确定的位置,不随滚动条的移动而变化;

                注意:固定定位的位置是相对当前浏览器窗口的;

代码示例:

1.我们先在页面中输出一个标准情况下的 div 元素,不添加定位;

代码:


<!doctype html>
<html>
   <head>
          <meta charset="utf-8">
          <title></title>
          <style>
            *{margin:0;padding:0;}
             .abc{width:200px; height:200px; background-color:red; border:2px solid yellow;}
          </style>
   </head>
   <body>
            <div class="abc"></div>
   </body>
</html>


页: [1]
查看完整版本: CSS 固定定位 position fixed