I have a page with a header position:fixed DIV at the top. This DIV is height:300px and it is fixed so that it’s always visible even when users scroll down.
My content is in another DIV below. It has a position:absolute with a top:300px. So when you first load the page, it starts below my header and when you scroll, it scroll underneath my header which stays fixed at the top.
In my content DIV, I have multiple anchor. When I click a link to one of these anchor, the page scrolls but places the anchor right at the top of the page. So basically, the content that was supposed to be displayed is hidden under my header…
Do you have any idea how to fix this problem with HTML/CSS..?
Is there another solution apart from using iframe or a frameset..?
You can do it with jquery.
First you need to include the jquery library in you
<head>f you aint already.under the above you need the following javascript
The following line from the above script controls the offset, or ‘margin’ from the top.
You can also make the scroll smooth by increasing the value on this line.
try replacing it with this.