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 属性的值。
  • 相关阅读:
    中文字符集编码Unicode ,gb2312 , cp936 ,GBK,GB18030
    深入理解linux i节点(inode)
    汉字区位码、机内码学习笔记
    CSDN密码使用前10名
    GB2312汉字区位码、交换码和机内码转换方法(转)
    我的网名为什么是ma6174????
    解决CHM文档在linux下的乱码问题
    数据结构实验二:栈和队列的基本操作和应用
    精确记算程序的运行时间或者某段代码的运行时间
    键盘、游戏、ASCII码引出的一系列问题
  • 原文地址:https://www.cnblogs.com/tomorrowtodie/p/9716296.html
Copyright © 2011-2022 走看看