PDA

View Full Version : css auto width/height



Bobio
Feb 19th, 2010, 12:25 AM
Hello there,

I have searched everywhere for a solution, but oddly can't find anything! There are tons of posts on this forum regarding auto widths not working as desired in IE(6,7,8). I am attempting to position a floating menu in the upper right hand corner of a page that will stay in the same position while the user scrolls down the page. The code below works perfectly in Firefox, but not IE:



#menu {
position:fixed; /* also tried- position: absolute; position: relative; */
top: 12em;
right: 3em;
width: auto;
height: auto;
background-color:#FFFFFF;
border: 2px solid #301818;
padding: 4px;
font-family:Arial, sans-serif;
}


Maybe I am missing something simple here, but in Firefox (with the 2 position options above), whatever I type into <div id="menu"></div>, the menu will adjust to that length.

However, in IE, fixed position displays on the page where it should, but as one long bar (same height as Firefox) that fits to the entire screen and doesn't move down when I scroll. Position: absolute; position: relative; displays the long bar not at the same place as before, but instead at the very top of the page.

I would really appreciate any thoughts. Thanks in advance,

~Bobio

Excavator
Feb 19th, 2010, 12:45 AM
Hello Bobio,
IE6 does not support position:fixed;

Have a look at a fix for that here - http://nopeople.com/CSS/fixed_background/index.html

Bobio
Feb 19th, 2010, 01:04 AM
Thanks Excavator, but I'm not sure how that linki is supposed to help. There is a fixed background, which isn't what I am trying to do. I am trying to create a hovering menu that will be on top of text, not below. Yes, I know IE6 does not support fixed.

Any other thoughts or comments would be greatly appreciated!

metathirteen
Feb 19th, 2010, 01:44 AM
i think u need to use z-index somewhere

Excavator
Feb 19th, 2010, 02:33 AM
Sorry about that... guess I got confused when I saw you had position:fixed; on your menu.
If you're just wanting a menu on top of another element then metathirteen has already given you the answer.