fixed

申明为fixed,不管屏幕如何滚动,申明fixed的元素都不会滚动。脱离文档流 可以通过left、top、right、bottom来进行规定

<html>
  <head> 
    <style type="text/css">
      div{
        /*系统默认是static,表示没有定位,忽略top,bottom,left,right*/
        position:fixed;
        background-color:#ff0000;
        border:3px solid #73AD21;
        top:50px;
      }

    </style>
    <title>test</title>
  </head>

  <body>
    <p>title</p>
    <div>
      content
    </div>
    <p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</p><p>Some text</p>


  </body>
</html>
position
JSRUN前端笔记, 是针对前端工程师开放的一个笔记分享平台,是前端工程师记录重点、分享经验的一个笔记本。JSRUN前端采用的 MarkDown 语法 (极客专用语法), 这里属于IT工程师。