s我们做网站,底部一般会有版权信息,当页面内容高度不够时,版权部分就不是总在底部了。
利用flex布局,达到我们的要求。
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<style type="text/css">
html,body{height: 100%;}
.wrapper{display: flex;flex-direction: column;min-height: 100%;}
.header{flex: 0;background: blue;}
.section{flex: 1;background: #dedede;}
.footer{flex: 0;background: red}
</style>
<body>
<div class="wrapper">
<div class="header">header</div>
<div class="section">section</div>
<div class="footer">footer</div>
</div>
</body>
</html>
但我们在Vue项目中,发现没有效果。需要我们去App.vue中给id名为app的元素添加样式。
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
参考:https://blog.csdn.net/hb9278/article/details/96433386