I have a div that has its header
and its content that has height
fixed and it has scroll .
How to put position: fixed
in header
(where is the title), without moving it when scroll goes with the page?
Example:
HTML
<div class="main">
<div id="conversation">
<div class="header">
<h3>Título</h3>
</div>
<div class="content">
<ul>
<li>Primeira conversa</li>
<li>Segunda conversa</li>
<li>Terceira conversa</li>
<li>Terceira conversa</li>
<li>Terceira conversa</li>
<li>Terceira conversa</li>
<li>Terceira conversa</li>
<li>Terceira conversa</li>
<li>Terceira conversa</li>
<li>Terceira conversa</li>
<li>Terceira conversa</li>
<li>Terceira conversa</li>
</ul>
</div>
</div>
</div>
CSS
body, html{
height: 150%
}
#conversation{
width: 400px;
border: 1px solid #eee;
height: 400px;
overflow-x: hidden;
}
.header{
background: #4ECDC4;
color: #fff;
text-align: center;
height: 40px;
position: fixed;
width: 385px;
}
.content{
margin-top:35px;
}
ul{
margin: 0;
padding: 0;
}
li{
list-style: none;
padding: 20px 10px;
border-bottom: 1px solid #eee;
}