2

I am working on a web page (link) whose layout has a header on top, across the entire page, and then underneath two side-by-side sections, div.content and div.sidebar.

While the viewers are scrolling down, I want the sidebar to remain at the top of the page (i.e., a floating sidebar).

When using position:fixed in css, it works fine, except at the top of the page, where the sidebar overlaps with the header.

If I use a top:200px, it goes under the header, but when people are scrolling, the sidebar stays lowered.

Is it possible to have the sidebar behave regularly when the user is at the top of the page, so the sidebar doesn't interfere with the header, but have the sidebar float at theh top (top:0px, for example) when the user is scrolling and the header is off the screen?

4

1 に答える 1

0

これをに追加しdiv.sidebarます:

position: fixed;
top: 200px;
right: 20px; /* change this if you want */
于 2012-08-17T13:54:06.077 に答える