KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to fix a div so it always sticks to the top of the screen, using: position: fixed; top: 0px; right: 0px; However, the div is inside a centered container. When I use position:fixed it fixes the div relative to the browser window, such as it's up against the right side of the browser. Instead, it should be fixed relative to the container. I know that position:absolute can be used to fix an element relative to the div , but when you scroll down the page the element vanishes and doesn't stick to the top as with position:fixed . Is there a hack or workaround to achieve this?
Tags (comma-separated)
Save Edits
Cancel