flex 左侧固定宽度,右侧自适应

2019-10-24  本文已影响0人  igor_d140
<!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>flex</title>
    <style>
        html,body {
            padding: 0;
            margin: 0;
        }
        .container{
            width: 100%;
            height: 100vh;
            display: flex;
        }
        .sidebar::before {
            content: ' ';
            width: 200px;
            height: 100%;
        }
        .sidebar {
            display: inherit;
            background: #f5f5f5;
        }
        .main {
            background: gray;
            width: 100%;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="sidebar"></div>
        <div class="main"></div>
    </div>
</body>
</html>
上一篇 下一篇

猜你喜欢

热点阅读