CSS cannot do it by itself.
Position: fixed works in relation to the viewport, but does not contain an element.
I saw an attempt to solve this problem using the CSS3 transform property, but (as you noted in your comment on my first answer) that doesn not seem to work.
I understand that you cannot use any client library, but this is the only solution available to my mind. For you and others that you might someday need, here is a solution that works. It uses a bit of jQuery:
Positioning an element inside another element with a positioned element fixed along the x and y axes (that is, the position is fixed horizontally and vertically).
http://jsfiddle.net/8086p69z/8/
HTML
<div class="moving-article"> <div class="container"> <header class="fixed-header">FIXED HEADER</header> <ul> <li>SCROLL</li> <li>SCROLL</li> <li>SCROLL</li> </ul> </div> </div>
CSS (corresponding section)
.moving-article { height: 150px; width: 75%; overflow-x: scroll; } .fixed-header { background: rgba(0,0,0,0.5); width: 50%; text-align: center; line-height: 40px; position: absolute; top: 0; left: 0; } .container{ width: 1000px; }
JQuery
var leftOffset = parseInt($(".fixed-header").css('left')); $(window).scroll(function(){ $('.fixed-header').css({ 'left': $(this).scrollLeft() + leftOffset }); });
source share