zoukankan      html  css  js  c++  java
  • 布局时间布局

    今天做了一个小布局它的原理就是利用margin的负值当然因为使用到了定位的元素所以也可以用定位的方法来替换margin的作用

    1.使用到了自适应高度

    2.margin负值的运用

    3.百分比获取的应用

    4.清楚浮动的应用

    代码:

    <!DOCTYPE html>
    <html xmlns=http://www.w3.org/1999/xhtml>
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <meta name="Keywords" content=""/>
        <meta name="Description" content=""/>
        <style type="text/css">
            *{padding:0;margin:0;}
            .cf:after,.cf:before{content:' ';display: table;}
            .cf:after{clear:both;}
            .cf{*zoom:1;}
            .box{width: 405px;border: solid 2px red;overflow: hidden;}
            .ls{float: left;width: 200px;height: 100px;position: relative;}
            .rs{float: right;width: 200px;height: 100px;position: relative;}
            .middle{float: left;width: 5px;background: #000000;padding-bottom:100%;margin-bottom:-100%;}
            .l-sub .tel,.r-sub .tel{height: 5px;line-height:5px;overflow:hidden;border-top:solid 2px white;border-bottom:solid 2px white;background: black;position: absolute;}
            .l-sub .tel{width: 100%;margin-right:-5px;padding-left:5px;}
            .r-sub .tel{width: 100%;margin-left:-5px;padding-right:5px;}
            .r-sub{padding-top:20px;}
        </style>
    </head>
    <body>
        <div class="box cf">
            <div class="ls">
                <div class="l-sub">
                    <p class="tel"></p>
                </div>
            </div>
            <div class="middle"></div>
            <div class="rs">
                <div class="r-sub">
                    <p class="tel"></p>
                </div>
            </div>
        </div>
    </body>
    </html>
    View Code

    效果图:

  • 相关阅读:
    Linux下GCC的使用
    Hadoop c++开发
    如何区别PeekMessage&GetMessage SendMessage&PostMessage
    二叉树的三种遍历方式的循环和递归的实现方式
    各种排序算法的代码
    各种排序算法的总结
    EAX、ECX、EDX、EBX寄存器的作用
    浮点型在内存当中的存储方式
    error LNK2001: 无法解析的外部符号
    线程通信
  • 原文地址:https://www.cnblogs.com/BobSky/p/3108489.html
Copyright © 2011-2022 走看看