zl程序教程

您现在的位置是:首页 >  其它

当前栏目

flex:1将页面铺满

页面 flex
2023-09-11 14:22:19 时间

代码示范:

 

<!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>练习</title>
</head>
<body>
    <div id="main">
            <div id="aside">
                  hello 
            </div>
            <div id="content">
                   world
            </div>
        </div>
</body>
<script>
    
</script>
<style>
    #main  {
        display:flex;
    }
    #aside {
       width:300px;
       height:800px;
       background-color:aquamarine;
    }
    #content {
        height:800px;
        background-color: brown;
        flex:1;
        
       
    }
    body {
        margin:0;
    }
</style>
</html>

  

效果: