css怎么设置2个div同行,第一个固定宽度,第二个占满剩余的部分

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css怎么设置2个div同行,第一个固定宽度,第二个占满剩余的部分相关的知识,希望对你有一定的参考价值。

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
     
        body{
         
            margin:0;
        }
     
        .stage{
             
            position:relative;
        }
         
        .left{
         
            position:absolute;
            left:0;
            top:0;
            background-color:green;
            width:200px;
            height:500px;
        }
         
        .center{
         
            margin-left:200px;
            background-color:orange;
            height:500px;
        }
         
    </style>
</head>
<body>
    <div class="stage">
        <div class="left"></div>
        <div class="center"></div>
    </div>
</body>
</html>

 

以上是关于css怎么设置2个div同行,第一个固定宽度,第二个占满剩余的部分的主要内容,如果未能解决你的问题,请参考以下文章