Solved

CSS - stationary div at the top of the page while the rest of the page scrolls.

Posted on 2008-06-21
4
913 Views
Last Modified: 2012-06-22
I'm building a page that will have a navigation bar that spans the top of the page.  The page will be 1024px wide, centered in the browser window and there is a background image that will show on both sides of the page for windows that show more than 1024px in width.  I want the navigation bar to remain at the top of the browser window regardless of scrolling the page up and down.  What needs to be done with the CSS for this to work?
0
Comment
Question by:josephdaviskcrm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
nexusnation earned 500 total points
ID: 21838630
position:fixed; top: 0;

That little bit of CSS will rest a block-level element at the very top of your page.

For more, see:
http://www.w3schools.com/css/pr_class_position.asp
0
 

Author Comment

by:josephdaviskcrm
ID: 21852233
Sorry it took so long to get back to this one.

Ok... this works great in everything but IE6 (wonder of wonders).  What needs to be done for it to work the same?
0
 
LVL 12

Expert Comment

by:nexusnation
ID: 21852693
Not a problem..
IE 6 doesn't support position:fixed, so you'd have to use some sort of a hack. There are various ways to do this, but I have never needed to try this, so the best thing would be to Google "position fixed IE 6".

Here's what I came up with that looked somewhat promising:

http://web.tampabay.rr.com/bmerkey/examples/fake-position-fixed.html
http://www.howtocreate.co.uk/fixedPosition.html
http://tagsoup.com/cookbook/css/fixed/
0
 

Author Closing Comment

by:josephdaviskcrm
ID: 31469457
Thanks.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question