Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-01-2012, 04:27 PM   PM User | #1
loamguy1
Regular Coder

 
Join Date: Nov 2007
Posts: 106
Thanks: 13
Thanked 0 Times in 0 Posts
loamguy1 is an unknown quantity at this point
CSS scrolling with fixed header

I'm working on a website conversion project. There's one element I'm having a bit of trouble with in relation to CSS.

Currently the site is "tall" meaning the user has to use the browser scroll bar to scroll down and see all the content including the footer.

The goal is to have the site header stay in a fixed position on the screen and have the user use a scroll bar within the content to scroll up and down, always having the header be fixed and visible on the top of the screen.

Is this a candidate for the "overflow" property? Or would I need jquery to do something like this?

Thanks for thoughts...
loamguy1 is offline   Reply With Quote
Old 10-01-2012, 06:00 PM   PM User | #2
COBOLdinosaur
Regular Coder

 
COBOLdinosaur's Avatar
 
Join Date: Jul 2002
Location: Canada
Posts: 293
Thanks: 0
Thanked 18 Times in 18 Posts
COBOLdinosaur is an unknown quantity at this point
Just fix the header in CSS:

#header {
position:fixed; top:0px; left:0px;
}

Then for the start of the content set margin-top equal to the height of the header.
__________________
100% standards compliant code is 100% correct 100% of the time.
one of my toys from my repository and perhaps some help getting help

Cd&
COBOLdinosaur is offline   Reply With Quote
Old 10-01-2012, 07:22 PM   PM User | #3
loamguy1
Regular Coder

 
Join Date: Nov 2007
Posts: 106
Thanks: 13
Thanked 0 Times in 0 Posts
loamguy1 is an unknown quantity at this point
Wow, that looks a lot easier than I thought it would be.

Thanks a bunch!
loamguy1 is offline   Reply With Quote
Old 10-05-2012, 04:25 PM   PM User | #4
loamguy1
Regular Coder

 
Join Date: Nov 2007
Posts: 106
Thanks: 13
Thanked 0 Times in 0 Posts
loamguy1 is an unknown quantity at this point
FYI, this works except the margin-top needs to be padding-top.

Thanks again.
loamguy1 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:32 AM.


Advertisement
Log in to turn off these ads.