Bon*_*chi 3 html css html5 css3
我想要的是:
这只能用CSS和HTML(没有任何javascript)吗?
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8"/>
<title>Test</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"/>
<style>
*{
margin:0px;
padding:0px;
}
header, nav, article, footer, address {
display: block;
}
header{
position:relative; height: 50px; background-color:#2b2b2b;
}
footer{
height: 50px;
width:100%;
bottom: 0px;
position: fixed;
background: red;
}
#explorer{
position:relative; bottom:55px;
}
#sections{
width: 100%; height: 100%; bottom: 55px; position:fixed; background: blue;
}
</style>
</head>
<body style="background-color:yellow">
<header >
<h1>Test</h1>
</header>
<div id="explorer" >
<div id="sections" >
</div>
</div>
<footer>
/* Footer Content */
</footer>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
小智 5
我认为Kit的代码只需要一次调整即我们必须删除高度:100%来自div 部分它会正常工作.同时在测试以下代码时,我注意到如果我们将高度降低到超出限制,则页脚实际上位于标题之上.虽然,实际上高度永远不会那么低,但你仍然可能想要将z-index:5000添加到标题标签中