gpt4 book ai didi

html - 如何在没有 javascript 的情况下使用 css 混合固定和百分比高度/宽度

转载 作者:太空狗 更新时间:2023-10-29 15:52:13 25 4
gpt4 key购买 nike

我想实现这样的布局:

 -----------------------------------------------------------
| |
| fixed height |
| |
|----------------------------------------------------------|
| | s |
| takes all the rest available screen height | c |
| fluid height, not fixed, | r |
| dependent on the screen height | o |
| | l |
| | l |
| | b |
| | a |
| | r |
------------------------------------------------------------

用css和html,不用javascript,可以吗?滚动条应该从上到下完全可见。

最佳答案

参见: http://jsfiddle.net/s7FH6/show/ ( edit )

HTML:

<div id="header"></div>
<div id="content"></div>

CSS:

html, body {
margin: 0;
padding: 0;
overflow: hidden
}
#header {
background: #ccc;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 150px
}
#content {
background: #eee;
position: absolute;
left: 0;
top: 150px;
bottom: 0;
width: 100%;
overflow-y: scroll
}

关于html - 如何在没有 javascript 的情况下使用 css 混合固定和百分比高度/宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6732027/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com