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;
      }
     
     
     
  • 相关阅读:
    进程的实践与练习2
    士兵队列训练问题
    大数相加
    Ignatius and the Princess II
    Parentheses Balance (括号平衡)---栈
    简单计算器
    C++全排列函数next_permutation()和prev_permutation()
    黑白图像
    9*9乘法表
    输入5 个数按从小到大的顺序输出
  • 原文地址:https://www.cnblogs.com/gogogoing/p/9703880.html
Copyright © 2011-2022 走看看