CSS - Floating Box (fixed Position Menu)
I have seen this done but can't find any examples at the moment, but what I am looking to emmulate is have a page that required vertical scrolling. On either the left or right hand side is (for example) a square image and directly below it is a menu. When the user scrolls down the page the image goes off the top but the menu sticks to the top so is always visable. When the user scrolls back up as soon as the image starts to appear it pushes the menu back down so it is sat below the image. If i used position:fixed I can keep the menu in the same place when scrolling but I would like it to rise to the top of the browser when space is availble when scrolling.
Make sense? Similar TutorialsHi all, I've got a site which you have to scroll horizontally to view the content (different eh?), but I want the menu to stay in a fixed position on the left side of the screen. Can anyone tell me if/how I can do this? Cheers! How can I fix a Div a set distance below another Div without a set height? I don't know why I'm having such a hard time with this. I'm trying to build a "message box" for an application that I'm working on. Box requirements: Fixed width Variable height (fit to content) Centered on page Floating over other elements (I don't want the rest of the elements on the page to move when the box is displayed) Must work in IE/FF/Safari Here's what I tried: css Code: Original - css Code #message_box{ border: 1px solid #AAA; background-color: #DDD; width: 400px; display: none; /* This gets changed to block by javascript */ position: absolute; top: 0px; text-align: center; margin: 20px 0px 0px 0px; padding: 20px; font-size: 12px; z-index: 20; }
That creates a box that I'm happy with, but I'm having problems figuring out how to center it on the page. Do I have to put another div element around my #message_box element? Is there a way to center it with margins? Examples would be appreciated... Also, in IE, form drop downs "bleed through" the box. The box covers up everything except <select>s. Is there any fix for that? I really need a code. It is for a Multiple Fixed Floating Images at specific margins Fixed is very important. AKA. Scrolls with page. margins are img1 - left: 40px top: 40px img2 - left 56px top: 300px; Thank You Very Much. -Please Help! --nick11682 i am trying to do this example here w3schools.c0m/css/tryit.asp?filename=trycss_position_fixed the o, in .com has been changed to 0 so i could post. sorry the text " Some more text " I wish to had dead center on the right side of the page, not near the top like that, mainly, i wish to put two more lines of text just under it as well, all being dead center of the page, on the right, i cannot figure it out, any help please? Since position:fixed does not work in IE, are there any other ways to achieve the fixed effect, without using javascript? ok my site works perfect in ffox but when i load it in ie the fixed position dose not work :'( why not?, if i go back in firefox it will hello all. Got a prob, i have got a stylesheet with a load of divs on but one of them has the following structure Code: #logodiv { float: left; margin-left: 20px; width:91px; height:126px; background-image: url(../images/logo/gglogoweb.gif); background-position: 1% 2px; background-repeat:no-repeat; visibility: visible; z-index:1; } The problem i am having is that i need this in the center of a LHS bar...however the above setting is correct for IE but not for MozFF and Netscape Is there anything i can do to fix this? If anyone has any ideas that would be really great, thanks in advanced RF p.s. here is the complete CSS if needed Code: body { margin:0px; padding:0px; font-family: Georgia; color:#333; background-color:#FFFFDD; } h1 { margin:0px 0px 15px 0px; padding:0px; font-size:28px; line-height:28px; font-weight:900; color:#ccc; } p { font:11px/20px Georgia; margin:0px 0px 16px 0px; padding:0px; } #Content>p {margin:0px;} #Content>p+p {text-indent:30px;} a { color:#FFFFDD; font-size:13px; text-decoration:none; /*font-weight:600;*/ font: Georgia; } a:link {color:#FFFFDD; font: Georgia;} a:visited {color:#FFFFDD; font: Georgia;} a:hover {background-color:#A6AE62; font: Georgia;} a.greenlink { color:#A6AE62; font-size:13px; text-decoration:none; font-weight:600; font: Georgia; } a.greenlink:link {color:#667138; font: Georgia;} a.greenlink:visited {color:#A6AE62; font: Georgia;} a.greenlink:hover {background-color:#A6AE62; color:#ffffdd; font: Georgia;} #logodiv { float: left; margin-left: 20px; width:91px; height:126px; background-image: url(../images/logo/gglogoweb.gif); background-position: 1% 2px; background-repeat:no-repeat; visibility: visible; z-index:1; } #slogandiv { height:137px; background-color:#A6AE62; visibility: visible; z-index:0; /* This is a fix for IE% */ voice-family: "\"}\""; voice-family:inherit; height:137px; } #MenuBar { position:absolute; top: 136px; left:0px; width:100%; height:32px; padding-bottom:2px; background-color:#667138; border-bottom:0px solid #A4AA54; line-height:17px; z-index:1; /* Again, the ugly brilliant hack. */ voice-family: "\"}\""; voice-family:inherit; height:32px; } /* Again, "be nice to Opera 5". */ body>#MenuBar {width:100%; height:32px;} #Content { text-align: center; padding:15px; border: 0px solid #000000; background-color:#ffffdd; z-index:0; } #header { height: 137px; background-color: #A6AE62; } #Menu { float: left; width:150px; padding:10px; background-color:#667138; border-right:2px solid #A6AE62; border-top:0px solid #A6AE62; line-height:17px; /* Again, the ugly brilliant hack. */ voice-family: "\"}\""; voice-family:inherit; width:150px; } /* Again, "be nice to Opera 5". */ body>#Menu {width:150px;} #randomcontent { margin:10px 62px 62px 200px; padding:0px; border: 1px solid #c0c0c0; background-color:#FFFFDD; } #errormessages { margin:10px 62px 0px 200px; padding:10px; border: 1px solid #c0c0c0; background-color:#FFFFDD; } #adminMenu { margin:14px 62px 0px 200px; padding:10px; border: 1px solid #c0c0c0; background-color:#FFFFDD; } Thanks I have a scrolling div on a page. Within the div is a tabular form. I want to place a button that is has a fixed position within the div. So if the HTML code is like this: Code: <div id="div1"> <div id="buttonID"></div> <form> <table> <tr> <td> </td> </tr> </table> <form> </div> The css I thought would achieve what I wanted is Code: #div1{ div1 CSS goes here. } #div1 #buttonID{ position: fixed; top: 300px; left: 20px; } However, while the button is fixed, its position is fixed in relation to the page, not within the div which is annoying. Can anyone point out what I'm doing wrong here? Can a sumbit button for a form be located outside the form or does it matter? I'll start with my code. code:--------------------------------------------------------------------------------<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css"> body { height: 100%; width: 100%; overflow: hidden; margin: 0px; padding: 0px; } #menu { position: absolute; display:block; bottom:0px; left:0px; width:100%; border:1px solid #002E80; background-color: #E5EFFF; } #content{ padding: 5px; width: 100%; height: 100%; overflow: auto; z-index: 100; } </style> </head> <body> <div id="content"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. </div> <div id="menu"> <table width="100%" border="0"> <tr> <td><div align="left"> <input type="button" name="prevBut" value="<< Prev" /> </div></td> <td><div align="right"> <input type="button" name="nextBut" value="Next >>" /> </div></td> </tr> </table> </div> </body> </html> -------------------------------------------------------------------------------- The problem falls on the positioning of the scrollbar. I need it to be over my bottom menu. Right now it falls below the menu. Why is this? The layout in question: Page: http://www.westeros.org/ASoWS/index-Frames.html CSS (general): http://www.westeros.org/ASoWS/ASoWS-All-Frames.css CSS (IE): http://www.westeros.org/ASoWS/ASoWS-IE.css In Mozilla the above CSS 'frames' layout is mostly working, save that I can't figure out a way to hide the text above the header and below the footer. Is that at all doable with this layout? In IE, however, the header, footer and sidecolumns are all over the place. I have another CSS 'frames' layout (see the links below), which does work in IE, and part of the problem with the new layout seems to be that IE really doesn't like having left and right values specified for the header and footer. However, without those, I don't know how to make sure that they start and stop 10px away from the edge. Any workarounds for that that anyone can think of? Old CSS 'frames' layout (does work in IE): Page: http://www.westeros.org/BoD/ CSS (general): http://www.westeros.org/BoD/BoD-All.css CSS (IE): http://www.westeros.org/BoD/BoD-IE.css Please look at this URL http://www.finance.samif.com/Koelkast When I select any check box on left column then one pop up is display on screen. This image shows properly in Fire fox. When I scroll up down then image is fixed in fire fox. Vertically and Horizontal But when I used IE and select check box on bottom left menu then I can't see pop up image. Because this is not display vertically middle or it is not fixed. Please give me idea or suggestion how I can fix it. Thanks Hello, Is there a method by which we can use position:fixed in Internet Explorer 5.5 and 6.0 ? I have searched google but did not find anything really useful. Please help me. Hi All, I have been working on this validated site - http://www.edgeandbarrett.com/zub/test2/logo.htm and it works on all browsers, mac and pc, all apart from IE7 (and 6 of course with fixed). When viewing it, on ie7, it seems the padding is not being read, so the fixed navigation, is overlapping my content. This is the css - Code: * { margin : 0; padding : 0; } img { display : block; border : 0; } body { background-color : #eeeeee; font-family : helvetica, arial, sans-serif; line-height : 18px; } hr, .hide { position : absolute; top : 0; left : 30px; } #site { width : 870px; margin : auto; } #header { position : fixed; display : inline; height : 100%; width : 200px; top : 30px; background : #eeeeee; z-index : 4; } #logo { position : relative; top : 10px; z-index : 5; } .picbar { position : relative; padding-top : 5px; padding-bottom : 5px; margin-top : 22px; margin-bottom : 12px; border-top : 1px solid #9f9f9f; border-bottom : 1px solid #9f9f9f; z-index : 6; } .menu { position : relative; width : 190px; z-index : 7; } .menu .title { font : bold 13px Georgia, "Times New Roman", Times, serif; color : #333333; padding : 5px 0 5px 0; } .menu .title a { text-decoration : none; color : #333333; } .menu .title a:hover { text-decoration : none; color : #940f04; } .menu .title a:visited { text-decoration : none; color : #940f04; } .menu ul { list-style-type : none; } .menu ul li { padding-bottom : 2px; } .menu ul li a { font : normal 12px Arial; color : #333333; padding : 7px 0 7px 0; line-height : 17px; text-decoration : none; } .menu ul li a:visited { color : #940f04; } .menu ul li a:hover { color : #940f04; } .menu h1 { padding : 5px 0 5px 0; font-family : Georgia, "Times New Roman", Times, serif; font-size : 13px; color : #333333; } .menu a { color : #333333; text-decoration : none; } .menu a:hover { color : #940f04; } #container { position : relative; background-color : #fff; width : 650px; margin-left : 220px; padding-top : 90px; z-index : 3; } #container h1 { padding-bottom : 10px; padding-bottom : 10px; font-family : Georgia, "Times New Roman", Times, serif; font-size : 13px; color : #333333; } #container h2 { padding-bottom : 10px; padding-bottom : 10px; font-size : 13px; color : #333333; } #container p { padding-bottom : 10px; font-size : 13px; color : #333333; border-bottom : 1px solid #9f9f9f; } #container a { color : #000; text-decoration : none; } #container a:hover { color : #940f04; } .pic { padding-top : 5px; padding-bottom : 5px; margin-bottom : 18px; border-top : 1px solid #9f9f9f; border-bottom : 1px solid #9f9f9f; } .text { background-color : #fff; width : 420px; padding-bottom : 30px; font-size : 13px; color : #333333; } .about { background-color : #fff; width : 420px; padding-bottom : 30px; margin-bottom : 20px; font-size : 13px; color : #333333; border-bottom : 1px solid #9f9f9f; } .ser { background-color : #fff; float : left; width : 210px; padding-bottom : 15px; font-size : 13px; color : #333333; } .ser2 { background-color : #fff; float : left; width : 210px; padding-left : 8px; padding-top : 47px; padding-bottom : 15px; font-size : 13px; color : #333333; } .test { background-color : #fff; width : 420px; padding-bottom : 30px; font-size : 13px; color : #333333; } .line { background-color : #fff; float : left; width : 420px; padding-bottom : 15px; margin-bottom : 20px; border-bottom : 1px solid #9f9f9f; } #footer { position : relative; background-color : #fff; width : 650px; margin-left : 220px; padding-top : 20px; padding-bottom : 20px; border-top : 1px solid #9f9f9f; z-index : 1; } #footer p { font-family : Georgia, "Times New Roman", Times, serif; font-size : 12px; color : #505050; text-align : left; } #footer a { color : #505050; text-decoration : none; } #footer a:hover { color : #940f04; } I have no idea the fix, have tried display:inline; and had a look around, but am not sure what the exact problem is, and am quite new so all a bit confusing. Any help would be really useful!!! i have also uploaded 2 screenshots. one how it looks on all other browsers . . . and one on IE7!!! http://www.edgeandbarrett.com/zub/test2/how%20it%20should%20look.png http://www.edgeandbarrett.com/zub/test2/ie7.png Its the only issue i have before i can complete site . . . . . . and really want to crack on!!!!!! Thanks, Orwel Hello all i am having trouble with getting a layer to stay put when i school down the page. This is my code: Code: #Layer1 { position:absolute; width:64px; height:73px; z-index:1; left: 0px; top: 101px; } <div id="Layer1"> <div align="left"><img src="images/gun.gif" width="58" height="73" /></div> </div> Everytime i scroll down the image goes with it. I need it stay where i put it without moving at all. If anyone could help then that would be great David Hello! I'm working on a website right now and have sort of dived in further than I understand conditional CSS. The website is he www.kekoz.com I have that little menu in the upper right and the info in the lower right. I like those being fixed so when the user scrolls they are always up there. But I can't figure out how to make them stop from colliding with the main pictures when you change the height of the page. Any help would be grand! Right now they're position super simple: Code: #links{ position:fixed; top: 20px; right:20px; width:300px; } Code: #info_box{ position:fixed; bottom: 25px; right:10px; width:550px; } I tried to set a minimum height on them, but I think that would have to do with some sort of a container around them. Or maybe I'm just going about it all wrong. Also a couple other things I'm sort of thinking. I would like the "Scroll this way" thing to always be centered between the lower edge of the pictures and the bottom of the window. Not %100 sure how to get that set up. And the last thing I'm thinking for this page, which I'm not sure is all CSS would be to have the "scroll this way" thing actually fade based on the scroll position. I think this might be Jquery but thought I'd throw it out there to see if anyone had any advice. I've created a website that uses position:fixed and would like to add a feature detector that would redirect users with incompatible browsers to an update page. I've been searching the web and haven't found any conclusive solutions specific too position:fixed and with redirection. Could anyone help? Thanks. Hello, I am trying to have make a 'facebook' style toolbar fixed to the bottom of the screen. This works on desktop browsers except Mobile Safari on the iPhone (due to the 'viewport' way of rendering the page). Is their a workaround for this? I have seen doctyper's method but can't get it to work. Thanks I have a web page with three columns. The column on the right is the menu column which i want to keep in a certain position even when the user scrolls down. I know how to do this using css, but the problem is that if the resolution changes so does the position of the column. Is there a way to fix the position only from the top of the browser window and use the center column (or container that holds the 3 columns) for the horizontal alignment? Thanks in advance |