我想实现这个布局: HTML 100%高度与多个在线滚动的div
- 页是1200像素宽和中心
- 页填满浏览器的高度的100%
- 页面不不滚动
- 绿色和红色div应该内嵌滚动而不是
- 只要标题(橄榄色,蓝色,黄色,橙色)变得更高,绿色和红色仍然应该f虐待页面,但不是更多
我一直在尝试一段时间,但我不知道如何使绿色(和红色)部分采取页面大小的其余部分。我不想使用绝对定位,因为我需要页面对标题的动态大小作出反应。 另外,如果可能的话,我真的不想使用Javascript。
这里是我到目前为止有:https://jsfiddle.net/n3uefLmp/
CSS:
html, body {
margin: 0px;
height: 100%;
}
#page {
position: relative;
margin: 0 auto;
width: 1200px;
min-height: 100%;
max-height: 100%;
height: auto !important;
}
#bar1 {
min-height: 40px;
background-color: olive;
}
#bar2 {
width: calc(100% - 175px);
height: 40px;
background-color: blue;
}
#bar3 {
width: calc(100% - 175px);
height: 135px;
overflow: hidden;
background-color: yellow;
}
#rightBox {
position: absolute;
right: 0px;
width: 175px;
height: 175px;
background-color: orangered;
float: right;
}
#left {
background-color: green;
min-height: 100%;
max-height: 100%;
width: 50%;
}
HTML:
<body>
<div id="page">
<header>
<div id="bar1"></div>
<div id="rightBox"></div>
<div id="bar2"></div>
<div id="bar3"></div>
<div style="clear: both;"></div>
</header>
<div id="left">
bla
</div>
</div>
</body>
关于我如何能使用纯HTML实现这一布局的任何想法/ CSS ?
谢谢!
我知道这个问题是不是使用引导程序,但是....使用自助将使这(和你的生活)100%更好。它会为你处理所有这些东西,并使你的页面响应。 –
给标题一个高度百分比和内容其余的高度百分比? 喜欢20%和80%?里面100%div – Nomistake
看看:http://stackoverflow.com/questions/1575141/make-div-100-height-of-browser-window –