美文网首页
左右布局,一边自适应,一边固定

左右布局,一边自适应,一边固定

作者: 瘾_95f1 | 来源:发表于2019-05-06 11:38 被阅读0次
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <style>
            *{
                margin: 0;
                padding: 0;
            }
            .app {
                clear: both;
            }
            .left {
                background: #eee;
                padding: 20px;
                overflow: hidden;
                height: 300px;
                word-break: break-all;
            }
            /* float: left   改为left就可以变成左固定,右自适应*/
            .right{
                float: right;
                background: blue;
                width: 300px;
                height: 300px;
                padding: 20px;
                word-break: break-all;
            }
            .q {
                width: 100%;
                height: 20px;
                background: red;
                margin-top: 50px;
            }
        </style>
    </head>
    <body>
        <div class="app">
            <div class="right">
                888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
                <div class="q">宽度100%</div>
            </div>
            <div class="left">
                888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
                <div class="q">宽度100%</div>
            </div>
        </div>
    </body>
    </html>
    

    相关文章

      网友评论

          本文标题:左右布局,一边自适应,一边固定

          本文链接:https://www.haomeiwen.com/subject/hakroqtx.html