zoukankan      html  css  js  c++  java
  • 页面布局实例

    实例1

    <!DOCTYPE html>
    <html>
    <head>
    <style type="text/css">
    #container {
        position: absolute;
        border: 1px solid blue;
        left: 10px;
        top: 10px;
        right: 10px;
        bottom: 10px;
    }
    #left {
        position: absolute;
        border: 1px solid red;
        width: 100px;
        left: 0px;
        top: 0px;
        bottom: 0px;
    }
    #right {
        position: absolute;
        border: 1px solid green;
        right: 0px;
        left: 100px;
        top: 0px;
        bottom: 0px;
    }
    #hide1 {
        position: absolute;
        border: 1px solid orange;
        width: 10px;
        left: 0px;
        top: 0px;
        bottom: 0px;
    }
    #main {
        position: absolute;
        border: 1px solid cyan;
        right: 0px;
        left: 10px;
        top: 0px;
        bottom: 0px;
    }
    #main-bottom {
        position: absolute;
        border: 1px solid purple;
        height: 200px;
        right: 0px;
        left: 0px;
        bottom: 0px;
    }
    #main-top {
        position: absolute;
        border: 1px solid pink;
        top: 0px;
        right: 0px;
        left: 0px;
        bottom: 200px;
    }
    #hide2 {
        position: absolute;
        border: 1px solid orange;
        height: 10px;
        left: 0px;
        right: 0px;
        bottom: 0px;
    }
    </style>
    </head>
    <body>
    <div id="container">
        <div id="left">
        </div>
        <div id="right">
            <div id="hide1">
            </div>
            <div id="main">
                <div id="main-top">
                    <div id="hide2">
                    </div>
                </div>
                <div id="main-bottom">
                </div>
            </div>
        </div>
    </div>
    </body>
    </html>
    <script>
    var hide1 = document.getElementById('hide1');
    var left = document.getElementById('left');
    var right = document.getElementById('right');
    hide1.onclick = function() {
        var interval = setInterval(function() {
                console.log(left.offsetWidth);
                left.style.width = left.offsetWidth - 10 + 'px';
                right.style.left = left.offsetWidth + 'px';
                if (left.offsetWidth < 10) clearInterval(interval);
            }, 100);
    }
    </script>
    View Code
  • 相关阅读:
    Linux-Zabbix 邮件报警设置
    CentOS6.7 防火墙规则(Iptables)
    CentOS7 防火墙规则 (firewalld)
    windows搭建代理服务器
    Linux服务器的远程IP限制
    利用shell脚本监控目录内文件改动
    CentOS 7, 升级python到3.x
    CentOS 7, Attempting to create directory /root/perl5
    变长参数表
    C语言预处理
  • 原文地址:https://www.cnblogs.com/feilv/p/4583978.html
Copyright © 2011-2022 走看看