• HTML流动布局各种宽度自适应


    <!DOCTYPE html>
    <html lang="en">
    <style>
        html,body{
            padding: 0;margin: 0;
        }
        div{
            font-size: 12px;
        }
    </style>
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    </head>
    <body>
    <div style=" 100%;height: 50px;background: red;">
        <div style="float: left; auto; background: green;height: 100%;">
            区域1自适应:
        </div>
        <div style="height: 100%;background: brown;overflow: hidden">
            <div style="float: right;height: 100%;background: blue; 60px;">
                区域2固定宽度60
            </div>
            <div style="height: 100%;background: yellow; auto; overflow: hidden">
                <div style="float: left; 100px;background: gold;height: 100%;">
                    区域3固定宽度100px
                </div>
                <div style="background: rebeccapurple;height: 100%;overflow: hidden">
                    <!--内容垂直水平居中-->
                    <div   style=" 100%;height: 100%;display: table;text-align: center">
                        <div style=" 100%;height: 100%;display: table-cell;vertical-align: middle;">
                            区域4自适应剩下的宽度
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </body>
    </html>

    运行效果:

  • 相关阅读:
    【NOIP2017】奶酪
    【NOIP2017】时间复杂度
    【NOIP2005】过河
    【洛谷习题】垃圾陷阱
    dfs序
    bzoj2441 小W的问题
    彩色迷宫
    蛋糕与蛋挞
    树上倍增
    因数个数定理
  • 原文地址:https://www.cnblogs.com/JimmyBright/p/6078163.html
Copyright © 2020-2023  润新知