【HTML+CSS】右侧固定,左侧自适应布局

    <style>
        *{
            padding: 0;
            margin: 0;
        }

        #left{
            float: right;
            width: 100%;
            height: 300px;
        }

        #box{
            margin-right:220px;
            background-color: pink;
            height: 300px;
        }
        #right{
            float: right;
            margin-right: -100%;
            width: 200px;
            height: 300px;
            background-color: yellow;
        }
    </style>

 

<div>
    <div id="left">
        <div id="box"></div>
    </div>

    <div id="right" ></div>
</div>

 

posted @ 2018-05-08 11:33  krank  阅读(301)  评论(0编辑  收藏  举报