zoukankan      html  css  js  c++  java
  • 关于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;
      }
     
     
     
  • 相关阅读:
    List中的get(i)
    报空指针异常
    json数据请求
    springmvc中的字典表
    json的解析
    httpClient返回的数据类型,怎么弄
    java中webService
    红外遥控协议(NEC)
    很奇怪的GPIO地址
    emacs命令备忘
  • 原文地址:https://www.cnblogs.com/gogogoing/p/9703880.html
Copyright © 2011-2022 走看看