【CSS】实现两栏布局

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    html,body{
      height: 100%;
    }
    /*.box1{*/
    /*  width: 200px;*/
    /*  height: 100%;*/
    /*  background: #ff002b;*/
    /*  float: left;*/
    /*}*/
    .box1{
        width: 200px;
        height: 100%;
        background: #ff002b;
        float: left;
    }
    /*.box2{*/
    /*  height: 100%;*/
    /*  background: yellow;*/
    /*  margin-left: 200px;*/
    /*}*/
    .box2{
        width: calc(100% - 200px);
        height: 100%;
        background: yellow;
        float: left;
    }
  </style>
</head>
<body>
<div class="box1"></div>
<div class="box2"></div>
</body>
</html>

posted @ 2022-04-29 20:36  木子欢儿  阅读(26)  评论(0编辑  收藏  举报