6
It is possible to fix an element( div, img, p ) in a div with scroll
and with position:relative
and using only css?
*Currently reposition the div using the function $('elemento').scroll()
and calculating the scroolTop()
of the element but in IE( the worst browser in the world ) there is a kind of delay and the element gets 'tremendous' so I wonder if it is possible to do this only with CSS.
HTML:
<div class="divContainer">
<div class="conteudoFixo">
<h3>Objeto Fixo</h3>
</div>
<div class="conteudoNormal">
<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>
CSS:
.divContainer {
height:200px;
width:300px;
position:left;
overflow:auto;
border: 1px solid #FF0000;
position: relative;
}
.conteudoFixo {
position: absolute;
top:0px;
left:0px;
background-color:#FF00FF;
width:100%;
}
Example link: http://jsfiddle.net/uQLzv/
Maybe this question may have already answered your question
– Caputo
Caputo thanks for the answer is that already used it (javascript) to reposition my div, but in IE( damned ) occurs a delay then the div is tremendous. But finally thanks for the reply.
– Douglas dos Santos