这个问题将是页眉和页脚固定,内容可滚动和固定页眉,页脚与可滚动内容的重复,如果不是一个细节,这对我来说非常重要 - 我不想为内容指定固定的高度和宽度.
http://jsfiddle.net/mark69_fnd/PWRDa/包含一个带有虚拟数据的真实表单,展示了问题 - 调整窗口大小使滚动条出现,但在页面上,而不是在表单上。在当前布局中,菜单栏和状态栏被滚动到视图之外,我希望它们保持固定,而表单数据被滚动。
请不要提供绝对宽度和/或高度的解决方案。我更喜欢用 javascript 计算它们,而不是将它们烘焙到 CSS 中,除非它是 100%。当然,纯 HTML/CSS 解决方案更可取。
这是CSS:
html, body, .yui3-app-views {
height: 100%;
width: 100%;
}
.container {
position: relative; /* needed for footer positioning*/
margin: 0 auto;
height: auto;
min-height: 100%;
background-color: #eee;
}
.content {
background-color: #ddd;
padding: 0em 0em 2em; /* bottom padding for footer */
overflow: auto;
}
#footer {
position: absolute;
width: 100%;
bottom: 0; /* stick to bottom */
background-color: #ccc;
}
#status {
border: solid 1px #000000;
}
#status .error {
color: red;
font-weight: bold;
}
/* ------------------------------------------------------------------------------------*/
.char {
display: inline-block;
vertical-align: top;
}
.line {
white-space: nowrap;
}
/* --------------------------------- fieldset and legend ------------------------------*/
.fieldset {
border: 2px groove threedface;
margin-top: 1em;
}
.fakeFieldset {
padding: 2px;
}
.fieldset > div.legend:first-child {
display: inline-block;
text-align: left;
margin-left: 10px;
background: #ddd;
position: relative;
top: -0.7em;
}
.merge-bottom {
margin-bottom: -2px;
}
/* ------------------------------------ Forms ------------------------------*/
form div {
white-space: nowrap;
}
form select, form input {
margin: 2px;
border: 1px groove;
}
form label:not(.same-line) {
width: 8em;
text-align: right;
display: inline-block
}
#cust-balance {
text-align: center;
}
.ccExpDate {
width: 2em;
}
#cust-salutation {
width: 4em;
}
.postalCode {
width: 7em;
}
#cust-ccAddress {
width: 20em;
}