• 关于position的一些问题


     position属性:
      static:静止
      relative:相对的
      fixed:固定的
      absolu:绝对的

    position的一些实例子如下:

    HTML:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <link rel="stylesheet" href="./CSS文件/例子6.css">
    </head>
    <body>
            <div class="box" id="one">One</div>
            <div class="box" id="two">Two</div>
            <div class="box" id="three">Three</div>
            <div class="box" id="four">Four</div>
            <div id="id"></div>
           
       
    </body>
    </html>
    CSS:
    .box {
        100px;
        height: 100px;
        background: red;
        color: white;
      }
      #one{
        position: static;
      }
      #two {
        position: relative;/*relative的位置是基于原来的位置*/
        top: 1000px;
        left: 20px;
        background: blue;
      }
      #three{
          position: fixed;/* fixed简单描述:固定定位是将某个元素固定在浏览器的某个确定的位置,不随滚动条的移动而变化;

          注意:固定定位的位置是相对于前一个位置的;*/
          top: 200px;
          left: 500px;
          background: yellow;
      }
      #four{
        position: absolute;/*absolute相对于前一个位置的*/
        top: 20px;
        left: 700px;
      }
     
     
     
  • 相关阅读:
    uoj388 【UNR #3】配对树
    uoj386 【UNR #3】鸽子固定器
    回忆录
    xcode 把项目代码提交到远程SVN服务器
    IOS 点击按钮拨号
    ADO与达梦7产生的一个未知问题
    DSN 建立达梦7(DM)连接
    iOS UIControl 事件的说明(转)
    IOS开发copy,nonatomic, retain,weak,strong用法
    QT Creator 使用SVN的版本号做为编译的版本信息
  • 原文地址:https://www.cnblogs.com/gogogoing/p/9703880.html
Copyright © 2020-2023  润新知