zoukankan      html  css  js  c++  java
  • 位置

     <!doctype html> 
    <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>
    <style> 
    html{background:1px dashed red;} 
    body{background:1px dashed blue;} 
     
    .box {
      display: inline-block;
       100px;
      height: 100px;
      background: red;
      color: white;
    }
    #two {
      position: static;
      top: 20px;
      left: 20px;
      background: blue;
    }
    <!DOCTYPE html>
    <html>
    <head>
        <title>position</title>
        <style type="text/css">
        body{
            background: #7CF686;
        }
        /*<!--
        #pageHeader{
     
        }静态*/
        -->
     
        /*<!--#pageHeader h2{
            position: absolute;
            left: 200px;
            top: 200px;
        }-->绝对定位*/
         
        /*#pageHeader h2{
            position: relative;
            left: 200px;
            top: 200px;
        }相对定位*/
     
        /*#pageHeader{
            background:#DC1111;
            position:fixed;
             100%;
            top: 200px;
            left: 10px;
        }
        #box{
            height: 2000px;
            background: #725AF0;
        }j固定定位*/
        </style>
    </head>
    <body>
    <div id="pageHeader">
        <h1><span>99999</span></h1>
        <h2><span><acronym title="cascading style sheets">CSS</acronym>11111111</span></h2>
    </div>
    <div id="box"></div>
    </body>
    <ml>
    absolute:
    生成绝对定位的元素,相对于 static 定位以外的第一个父元素进行定位。
    元素的位置通过 "left", "top", "right" 以及 "bottom" 属性进行规定。
    fixed:
    生成绝对定位的元素,相对于浏览器窗口进行定位。
    元素的位置通过 "left", "top", "right" 以及 "bottom" 属性进行规定。
    relative:
    生成相对定位的元素,相对于其正常位置进行定位。
    因此,"left:20" static会向元素的 LEFT 位置添加 20 像素。
    static:默认值。没有定位,元素出现在正常的流中(忽略 top, bottom, left, right 或者 z-index 声明)。
    inherit:规定应该从父元素继承 position 属性的值。
  • 相关阅读:
    BUPT复试专题—最长连续等差子数列(2014软院)
    BUPT复试专题—奇偶求和(2014软件)
    BUPT复试专题—网络传输(2014网研)
    Hopscotch(POJ 3050 DFS)
    Backward Digit Sums(POJ 3187)
    Smallest Difference(POJ 2718)
    Meteor Shower(POJ 3669)
    Red and Black(poj 1979 bfs)
    测试
    Equations(hdu 1496 二分查找+各种剪枝)
  • 原文地址:https://www.cnblogs.com/tomorrowtodie/p/9716296.html
Copyright © 2011-2022 走看看