可能的问题 网站footer部分上浮,可通过css3的方式
html 结构 :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
*{margin:0px;padding:0px;}
html{height:100%;}
.site{display:flex;flex-direction:column;min-height: 100%;}
---------------------------------------// 所示橙色部分 可用 .site{display:flex;flex-direction:column;min-height: 100vh;} 表示
即是vh的意思 :视口被均分为100单位的vh 示例代码: h1 { font-size: 8vh; } 如果视口的高度是200mm,那么上述代码中h1元素的字号将为16mm,即(8x200)/100
.header{background:green;height:100px;}-----height:100px;可改为flex-basis:100px;
.main{background:pink;flex:1;} -------------------------------//要理解flex的意思,父元素减去未设置flex的子元素的部分,按照flex分
.footer{height:40px; background:orange;}
</style>
</head>
<body class="site">
<div class="header"></div>
<div class="main"></div>
<div class="footer"></div>
</body>
</html>
vh支持情况: