Click here to Skip to main content
15,913,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a question and have this in my mind:
"if an element has fix position in css it sticks to window and won't scrolled"

i have an article that has a title and contents like this:

XML
<article>
    <h3>Title</h3>
    <p>Content Here</p>
</article>



content is too large to fit in article so article element gets scrollbars,
i want when user scrolls the article, the title get fix position and won't scroll
and stick to the top of article.(using jquery)

excuse me for my bad english,i hope my question was clear to you!
Posted

add Style sheet property for internal

Tag that overflow:scroll;. this may be helpful to you. because if article has too much large content and if content is inside the

Tag then it will shows the scroll bar & header will be still there.

 
Share this answer
 
I have created fiddle for you.Check it here
Hope you want the same thing
 
Share this answer
 
Comments
bjdestiny 11-Oct-13 0:44am    
Hey Anoop..
Thanks in Advanced through out your answer i found something good for my self.!! :) :)+5
Moosavi S.M. 12-Oct-13 10:58am    
i saw the example but it's not what i wanted because if you try to scroll
the window, that little red div will move
i want the div to be fix either scrolling article or window!
Anoop Kr Sharma 13-Oct-13 3:44am    
As you are saying that you want the div to be fix either during scrolling article or window. I have created another fiddle for you.Check it here
Hope you want something like that

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900