我一直在布局一段时间。我决定在jsFiddle中掀起一个例子。HTML5布局问题
我遇到的问题是,ASIDE不会扩展到全高的它的父“包装”,只对视口的高度。 ASIDE也需要能够移动到右侧或左侧。
我打开其他方法创建此布局,没有表。
/* PHP option to control the width of all content by wrapper via style */
/* PHP option to control which side to float the sidebar to via style */
<div id="wrapper" style="width:100%;">
<aside style="float: right;">This Sidebar</aside>
<header>The Header</header>
<section>The Main Content Area</section>
<footer>The Footer</footer>
</div>
html, body {
min-height: 100%;
height: 100%;
}
#wrapper {
margin: 0;
padding: 0;
background: brown;
height: 100%;
}
aside {
width: 200px;
background: yellow;
height: 100%;
}
header {
height: 150px;
background: blue;
width: 100%;
}
section {
background: red;
width: 100%;
height: 100%;
}
footer {
height: 50px;
background: green;
width: 100%;
}
你什么意思,'aside'不会扩展为'#wrapper'的全高? '#wrapper'和'aside'每个都有'height:100%'规则,所以它们的高度都与'body'相同。 –