布局:flex弹性布局_固定底部、居中


有时,页面内容太少,无法占满一屏的高度,底栏就会抬高到页面的中间。这时可以采用Flex布局,让底栏总是出现在页面的底部。

.Site {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  border:1px solid red;
}

.Site-content {
  flex: 1;
  border:1px solid red;

  display:-webkit-flex;
  display:flex;
  justify-content:center;
  align-items:center;
}

article{
    width:600px;    
    height:260px;
    border:1px solid red;
}

 

<!doctype html> <html> 
<head>
    <meta charset="utf-8" />
    <title>H5标准页面</title>
    <link href="css/css实现树形图 - 副本 (2).css" rel="stylesheet" type="text/css" />
</head>
<body class="Site">
        <header>...</header>
        <main class="Site-content">
            <article>
                    
            </article>
        </main>
        <footer>……</footer>
</body>
</html

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM