I am trying to fix a div so it always sticks to the top of the screen, using:
However, a centred container contains the div. When I use position:fixed, the div is fixed with respect to the browser window, for example, up against the right side. It ought to be fixed relative to the container instead.
I'm aware that position:absolute may be used to position an element in relation to a div, but when you scroll down the page, the element disappears and doesn't stay at the top like it would with position:fixed.
Is there a trick or a way to get around this?