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

    效果图:

  • 相关阅读:
    KMP算法理解
    vimium 快捷键
    如何选择优化器 optimizer
    用python实现归并排序
    用python实现快速排序
    用python实现插入排序
    使用PyCharm进行远程开发和调试
    查看python iterpreter的路径和当前选择的解释器
    grid search
    一些书单
  • 原文地址:https://www.cnblogs.com/BobSky/p/3108489.html
Copyright © 2011-2022 走看看