Go Back   Forums @ The Digital Fix > Gadgets and Gizmos > Computing Forum

Reply
 
Thread Tools Display Modes
Old 08-07-2007, 10:36   #1
Guest 58450
Poke Us White Face
 
Guest 58450's Avatar
 
Join Date: Aug 2006
Location: London
Posts: 7,186
Thanks: 38
Thanked 12 Times in 10 Posts
Trying to fix a menu at the top of a page with CSS alone in IE. Can anyone help?

Hi,

I'd like to have a strip at the top of a page that has my menu and then fix it so that as you scroll down the page, the menu DIV is fixed at the top of the screen.

The code I've got works in Firefox and in Opera, but not in IE.

This is the CSS code (note ** and ** where ** is showing):
PHP Code:
body **
  
font-familygaramondserif;
  
margin0px;
  
padding0px;
  
display:block;
  
border:none;
  
position:relative;
**


#mainMenu **
  
positionfixed !important;
  
positionrelative;
  
z-index2;
  
top0;
  
left0;
  
margin0px;
  
padding0px;
  
width100%;
  
height50px;
  
background-colorblack;
  
colorwhite;
**

#menuLinks ul **
  
padding0;
  
margin0;
  
text-alignbottom center;
**

#menuLinks ul li **
  
list-stylenone;
  
padding0;
  
margin0 10px 0 10px;
  
displayinline;
  
text-aligncenter middle;
**

#spacer **
  
positionrelative;
  
height70px;
**

#container **
    
position:relative;
** 
Here's a link to a test page with the style information in the code:
http://theogb.com/theogb/test_styles.html

In firefox the black div sticks at the top as you scroll but in IE it just scrolls with the rest of the page.

Now the reason I'm assuming this should work is because of this page:
http://www.csszengarden.com/?cssfile...202.css&page=0

I've looked the CSS over but it doesn't seem to help.

Can anyone suggest how I can beat IE into submission over this. No one wants to use frames, obviously.
Guest 58450 is offline   Reply With Quote
Old 08-07-2007, 10:58   #2
Padwah
Fuelled By Alcohol
 
Join Date: Mar 2003
Location: New Forest
Posts: 2,383
Thanks: 1
Thanked 11 Times in 10 Posts
this: http://www.cssplay.co.uk/layouts/fixed.html looks like it might be of use.
__________________
My Feedback
Padwah is offline   Reply With Quote
Old 09-07-2007, 06:13   #3
Guest 58450
Poke Us White Face
 
Guest 58450's Avatar
 
Join Date: Aug 2006
Location: London
Posts: 7,186
Thanks: 38
Thanked 12 Times in 10 Posts
Quote:
Originally Posted by Padwah View Post
this: http://www.cssplay.co.uk/layouts/fixed.html looks like it might be of use.
Thank you, it looks promising.
Guest 58450 is offline   Reply With Quote
Old 09-07-2007, 17:36   #4
Guest 58450
Poke Us White Face
 
Guest 58450's Avatar
 
Join Date: Aug 2006
Location: London
Posts: 7,186
Thanks: 38
Thanked 12 Times in 10 Posts
Okay, interestingly the most important thing to making this work was this line:

PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
>
<
html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
Without that this trick doesn't work. Though this is using a different method to the layer method I was using.
Guest 58450 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Page Numbering in MS Word - starting with Page 1 from Page 5. Matt KB Computing Forum 9 15-03-2006 17:33
front page help please..optimizing a page for 1024x768.. backtothefuture Computing Forum 2 22-06-2005 07:37
Edge of page missing from web page prints Guest 24775 Computing Forum 2 05-06-2005 14:38
Printing whole threads rather than page by page - possible? Xenole Computing Forum 1 29-12-2004 16:02
FIXED !!! - Something is setting Internet Explorer home page to porn search page Tempest Computing Forum 21 31-10-2004 15:57

All times are GMT. The time now is 21:34.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2021, vBulletin Solutions, Inc.qq
Copyright ©2000 - 2021 Network N Ltd.