Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 如何在顶部添加标题div,在下面添加垂直滚动div?_Css_Layout_Header_Scroll - Fatal编程技术网

Css 如何在顶部添加标题div,在下面添加垂直滚动div?

Css 如何在顶部添加标题div,在下面添加垂直滚动div?,css,layout,header,scroll,Css,Layout,Header,Scroll,我想要一个两个div,标题和一个包含在div中的滚动列表 这就是我想要实现的目标: |_______header_______| | | | Container Div | | | | | | | | | | | ----------------------

我想要一个两个div,标题和一个包含在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;
}