Css 如何在顶部添加标题div,在下面添加垂直滚动div?
我想要一个两个div,标题和一个包含在div中的滚动列表 这就是我想要实现的目标:Css 如何在顶部添加标题div,在下面添加垂直滚动div?,css,layout,header,scroll,Css,Layout,Header,Scroll,我想要一个两个div,标题和一个包含在div中的滚动列表 这就是我想要实现的目标: |_______header_______| | | | Container Div | | | | | | | | | | | ----------------------
|_______header_______|
| |
| Container Div |
| |
| |
| |
| |
| |
----------------------
现在,我有了scroll content div,它可以自动滚动,但是如何添加标题俯冲呢
<div id="scroller_container">
<div class="jscroller2_up">
<?
echo $news;
?>
</div>
</div>
使用
位置:固定
。这里我有一个4em高的标题和一个全高的内容区。JSFIDLE:
HTML:
请尝试div.header{position:fixed;}
.jscroller2_up, .jscroller2_down, .jscroller2_left, .jscroller2_right {
margin: 0;
padding: 0;
}
#scroller_container {
width: 30em;
height: 8em;
background: white;
top: -300px;
left: 700px;
overflow: hidden;
}
<header>Header</header>
<main>
<p>main</p>
</main>
header {
position: fixed;
width: 100%;
height: 4em;
background: green;
}
main {
position: fixed;
bottom: 0;
top: 4em;
width: 100%;
background: red;
overflow: scroll;
}