April 25, 201214 yr Hey, I've done a bit of web development before but never had to use the fixed position in CSS. I've got a simple site, just a header and long page of content(navigation is just anchors to parts of the page) so the header needs to stay fixed to the page when the user scrolls. I'm having problems though as when I set the header to position fixed the content div starts from the top of the page rather than under the navigation so part of the content is cut off as it's hidden behind the header. I'm assuming this is an easy fix. I have code to post if it helps. Thanks.
April 25, 201214 yr You can just put another relatively positioned div of the same height below your fixed header.
April 25, 201214 yr Author ahh never thought about that! Done that, so now it loads fine first time, but when I press one of the navigation buttons that anchor to the divs, it doesn't stop at the start of the div it cuts a few lines off. Is this something to do with the header still covering it?
April 25, 201214 yr Could you move the anchor a bit higher (<a name="anchor"></a>), so the content you want to display isn't behind the fixed header?
April 25, 201214 yr Author Cheers for the replies, got it working in the end by adding a few line breaks at the start of each div so that it displays content in users view now
Create an account or sign in to comment