CSS - Fixed Image Positioning
Hey everyone, im having a problem. I am trying to get a picture fixed at the bottom of the screen and am stuck. Do i do it as a footer or do i do something else? Can anyone help me please cheers.
Similar TutorialsHi All, I'm trying to add an image that will remain fixed on the screen, and I'm having a hard time positioning it using CSS. I already have a background image for the body (which is tiled), and this image needs to sit above that image, but below the rest of the content. Here's my code as it stands now: CSS: Code: @charset "utf-8"; body { font: 100% Verdana, Arial, Helvetica, sans-serif; margin: 0; padding: 0; text-align: center; color: #000000; background-image: url(../assets/images/space_2_background.jpg); background-repeat: repeat; margin: 0; background-attachment: fixed; } .oneColElsCtrHdr #sirius2 { background-image: url(../assets/images/sirius_2.png); background-repeat: no-repeat; position: fixed; padding-top: 123px; padding-left: 743px; } .oneColElsCtrHdr #container { width: 58em; border: 1px solid #000000; text-align: left; margin-right: auto; margin-bottom: 0; margin-left: auto; padding-top: 30px; padding-bottom: 30px; } .oneColElsCtrHdr #header { background-image: url(../assets/images/header_background.png); background-repeat: no-repeat; height: 73px; padding-top: 0; padding-right: 10px; padding-bottom: 0px; padding-left: 20px; } .oneColElsCtrHdr #header h1 { margin: 0; } .oneColElsCtrHdr #logo { padding-top: 15px; padding-left: 3px; } .oneColElsCtrHdr #mainContent { background-image: url(../assets/images/page_1_background.png); background-repeat: no-repeat; padding-right: 20px; padding-bottom: 0; padding-left: 20px; padding-top: 0px; height: 520px; } .oneColElsCtrHdr #footer { background-image: url(../assets/images/footer_background.png); background-repeat: no-repeat; height: 244px; padding-top: 0; padding-right: 10px; padding-bottom: 0; padding-left: 10px; } .oneColElsCtrHdr #footer p { margin: 0; padding: 10px 0; } HTML: 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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Sphere Nine Media</title> <link href="css/main.css" rel="stylesheet" type="text/css" /> </head> <body class="oneColElsCtrHdr"> <div id="sirius2"></div> <div id="container"> <div id="header"> <div id="logo"><img src="assets/images/sphere_nine_logo_v9.0.1(website).png" alt="Sphere Nine Media Logo" width="191" height="37" /></div> <!-- end #header --></div> <div id="mainContent"> <!-- end #mainContent --> </div> <div id="footer"> <!-- end #footer --></div> <!-- end #container --></div> </body> </html> The code specific to this image is in bold red . I've tried coding this image both as a straight image and a background image, and I've gone through numerous iterations of changing positioning/padding/margin values, to no avail. The current code is the only variation I've happened upon that actually renders the image on the screen - you can see it live at http://www.spherenine.com/. Please let me know if this can be done using my current approach, or if there's a better way to accomplish it. I'll be happy to provide additional info if necessary. Thanks in advance. Sam Hi all, Okay, so I've got a page with a central column which has a drop-shadow and a background image... The obvious problem is that the repeated background image doesn't always line-up with the background image in the dropshadow. Plus, The backround image changes position whenever the page is resized. So I was looking here, to see if I could find the code to center the background image in the screen, and make it a fixed position, but even then, when you resize the page, the background image seems to move with it. Does anyone know how to fix a background image so that it will stay aligned with the central content/dropshadow of the page? Thanks. The link below shows the fixed positioning layout I need to achieve, but rather than have the scrolling content fixed to the left or right hand side I want to have it centered with the navigation fixed and just to the left of the scrolling content. Like the image below: http://limpid.nl/lab/css/fixed/header Is this possible? Thanks I have my website at omel.co.cc I have a menu that I positioned absolute, but when I view in a different resolution the menu changes position, I have put a parent div positioned relative but every time I scroll the menu moves which I do not want to, when positioned fix, the position of the menu goes off, on different resolutions and when I resize the window, I have googled these, hope someone could help, or I just did not googled enough? I realize older IE versions don't play nice with the position: fixed tag.... and I need an alternative. can someone please explain why this doesn't work? here is my style sheet.... Code: body { background-image: url(../images/spacer.gif); background-repeat: repeat; height: 100%; width: 100% color: 000; } p { margin-bottom: 0em; line-height: 1.5; } div.sub h4, div.sub { color: #000; } img { border: none; } div.main {text-align: left; width: 555px; height: 427px; clear: both; border: solid 0 #fff; padding: 0;} div.journalhead { position: absolute; top: 427px; left: 1px; width: 555px; height: 73px; } div.projects { position: absolute; top: 333px; left: 555px; width: 344px; height: 44px; } div.logo { position: absolute; top: 1px; left: 555px; width: 345px; height: 332px; } div.projectthumbs { position: absolute; top: 376px; left: 555px; } div#journalbottom { position: absolute; top: 453px; left: 1px; width: 555px; height: 47px; } ul { position: absolute; float: left; margin-bottom: 0; } ul#fader li img { text-align: left; position: fixed; top: 1px; left: 1px; width: 555px; height: 427px; padding: 0; } .fade{ margin-bottom: 0em; } .fade p{ margin-bottom: 0em; text-align: center; width: 100%; } a:link {color: #000; } a:visited {color: #000; } a:active {color: #333; } a:hover {color: #333; } any light shed would be great, i realize it's a bit sloppy at present. please help Using Firefox, the current state of the site I am working looks like I want it to look, yet in IE 6 it does not look correct, surprise. (IE7 looks great). I've tried several things, and I am completely lost as to a solution, I'd love some help, or suggestions, thanks. UTC Site Hi everyone, I have posted here [HTML Programming] because I'm not entirely sure what forum this particular problem should be put in. I have a fixed menu that I include using php. From looking at the source code I can see that it has definately included the menu. However IE only displays the menu 50% of the time. I have no idea why. At first I thought it was because I have a javascript animation for it to slide down, but I removed that and I still get the same problem. To see what I mean please visit twisted-reality.co.uk using IE and refresh a few times. Firefox, Opera, Safari and Netscape all display the menu fine, but IE feels like it needs to be different. I'm new to this forum but I hope someone can help Twisted-Daemon Join Date: May 2008 Posts: 2 Firefox bug combining absolute and fixed positioning Hey helpful people. I am designing a site which has a floating toolbar (position: fixed) with popup menus. The popup menus are using nested lists and position: absolute to display. JavaScript is dealing with the transition. The problem is that in firefox alone the fixed toolbar jumps when the popup menus show and hide. Removing either position: fixed or the offset (bottom: 27px) removes this problem. However these need to be present in the design. Anyone know a workaround? (webpage and css below) Code: <div class="toolbar_O"> <div class="toolbar_I"> <!-- top page info --> <div class="pageInformation cf"> <!-- Page Status Info Start --> <div class="pageStatus"> <h4 class="statusLabel">Status: </h4> <span class="status">Live</span> </div> <!-- Page Status Info End --> <div class="RHS cf"> <div class="toolbarMenu"> <ul> <li class="publicationDates"><a href="#" title="Publication dates">Publication dates<span class="moreArrow"><span class="wai">^</span></span> <!--[if gte IE 7]><!--></a><!--<![endif]--> <ul class="popup"> <li> <form> <p> <label for="email" class="expiryDate">Set expiry date</label> </p> <input type="text" class="inputTextbox" name="expiryDate" id="expiryDate"/> <p> <label for="email" class="liveDate">Set live date</label> </p> <input type="text" class="inputTextbox" name="liveDate" id="liveDate"/> </form> </li> </ul> </li> <li class="dateAction"><a href="#" title="Last published">Last published 29/01/08<span class="moreArrow"><span class="wai">^</span></span> <!--[if gte IE 7]><!--></a><!--<![endif]--> <ul class="popup"> <li> <p class="cf"><span class="label">Author:</span><span class="value">Anne Light</span></p> <p class="cf"><span class="label">Approver:</span><span class="value">John Smith</span></p> <p class="cf"><span class="label">Review date:</span><span class="value">21/06/07</span></p> </li> </ul> </li> <li class="versions"><a href="#" title="Other versions">Other versions (#)<span class="moreArrow"><span class="wai">^</span></span> <!--[if gte IE 7]><!--></a><!--<![endif]--> <ul class="popup"> <li> <p>Ann Light's version sent for approval on 24/12/07 at 10.03am</p> </li> </ul> </li> </ul> </div> </div> </div> <!-- bottom user functions --> <div class="userFunctions cf"> <!--Left Hand Side Buttons Start --> <div class="btnLHS"> <a id="#" class="btnHelp" title="Help" href="#">Help</a> <div class="toolbarMenu pageActions"> <ul> <li class="otherPageActions"><a href="#" title="Other page actions">Other page actions<span class="moreArrow"><span class="wai">^</span></span> <!--[if gte IE 7]><!--></a><!--<![endif]--> <ul class="popup"> <li> <ol> <li><a href="pa001a_delete_page.html" class="lbOn modal:{width:450}" title="Delete page">Delete this page</a></li> <li><a href="pa002_set_date.html" class="lbOn" title="Set date">Set publication/expiry date</a></li> <li><a href="pa003_page_permissions.html" class="lbOn modal:{width:450}" title="See page permissions">See page permissions</a></li> <li><a href="pa004_add_subpage.html" class="lbOn" title="Create sub page">Create sub page</a></li> <li><a href="pa005_page_history.html" class="lbOn modal:{width:450}" title="See page history">See page history</a></li> <li><a href="#">Preview</a></li> <li><a href="link_1d.html" class="lbOn modal:{width:450}" title="Save a copy">Save a copy</a></li> </ol> </li> </ul> </li> </ul> </div> </div> <!-- Left Hand Side Buttons End --> <!-- Right Hand Side Buttons Start --> <div class="btnRHS"><a href="st016_page_notes.html" class="lbOn pageNotes" title="page notes">See page notes</a> <a id="#" class="btnReject" title="Do Not Approve" href="#"><span class="buttonText">Don't Approve</span></a> <a id="#" class="btnApprove" title="Approve" href="#"><span class="buttonText">Approve</span></a> </div> <!-- Right Hand Side Buttons End --> </div> </div> </div> Code: div.toolbar_O { background: #eaf1f9 url(../images/interface/toolbar_bg.gif) 0 0 repeat-x; border: 1px solid #3a8ea8; padding: 9px 0px; width: 729px; color: #0a3b3f; font-size: 0.9em; position: fixed; bottom: 20px; left: 100px; height: 82px; } body.editMode div.toolbar_O { position: relative; left:0; bottom: 0; float:right; } .toolbar_O .toolbar_I { border: 1px solid #073f58; background: url(../images/interface/toolbarinner_bg.gif) #54b4cc; margin: 0px 9px; } .toolbarMenu ul li a, .toolbarMenu ul li a:visited { font-weight: bold; color: #77aeb5; border: 1px solid #287e95; text-decoration: none; padding: 4px 5px 6px 5px; background: #e6f4f5; color: #0a3b3f !important; display: -moz-inline-box; display: inline-block; height: 13px; } .toolbarMenu ul { padding:0; margin:0; list-style-type: none; margin: 0; } .toolbarMenu ul li { float:left; position:relative; margin: 0 0 0 10px; } .toolbarMenu ul li ul li { margin: 0; font-size: 0.9em; } .toolbarMenu ul li ul { visibility: hidden; position:absolute; bottom: 27px; left:0; padding: 5px; background: #ebf6f8; border: 1px solid #2e869c; margin: 0; z-index: 1000; font-size: 1em; text-align: left; } .toolbarMenu ul .moreArrow { display: -moz-inline-box; display: inline-block; padding: 6px 8px; width: 1px; margin-left: 10px; border-left: 1px solid #89abb7; background: url(../images/interface/morearrow.gif) 3px 0 no-repeat } .toolbarMenu ul li.open ul { visibility: visible; } .toolbarMenu ul li.versions.open ul { width: 250px; } div.toolbar_O .toolbarMenu ul li.open a { color: #4594A5 !important; } div.toolbar_O .toolbarMenu ul li.open .moreArrow{ background: url(../images/interface/closearrow.gif) 3px 0 no-repeat; } /* top part of toolbar */ .toolbar_O .pageInformation { padding: 6px; height: 25px; } .toolbar_O .pageInformation .pageStatus { color: #FFF; font-size: 1.3em; width: 170px; float: left; } .toolbar_O .pageInformation .RHS { float: right; } h4.statusLabel { height: 100%; display: inline; text-transform: uppercase; } div.toolbar_O div.pageInformation .label, div.toolbar _O div.userFunctions .label { width: 75px; float: left; text-align: left; } div.toolbar_O div.pageInformation .value, div.toolbar _O div.userFunctions .value { font-weight: bold; text-align: left; float: right; vertical-align: top; width: 75px; } div.toolbar_O div.pageInformation .inputTextbox { width: 80%; } /* bootom part of toolbar */ .toolbar_O .userFunctions { padding: 8px 0; height: 25px; } div.toolbar_O div.userFunctions div.btnRHS { float: right; margin: 0px 10px 0px 0px; } div.toolbar_O div.userFunctions .btnLHS { float: left; margin: 0px 0px 0px 10px; } div.toolbar_O div.userFunctions div.btnLHS a.btnHelp, div.toolbar_O div.userFunctions div.btnLHS a.btnHelp:hover { padding: 5px 5px 5px 25px; margin: 1px 5px 0 0; background: #e6f4f5 url(../images/interface/icon_help.gif) 3px 3px no-repeat !important; float: left; border: 1px solid #287e95; text-decoration: none; font-weight: bold; color: #0a3b3f; height: 12px } .toolbarMenu.pageActions { float: left; } .toolbarMenu ol { margin: 0; padding: 0; width: 320px; height: 60px; list-style: none; } .toolbarMenu ol li, .toolbarMenu ol li a { margin: 0; padding: 0; float: left; width: 150px; min-height: 8px; display: inline-block; border: none !important; color: #0a3b3f !important; font-size: 1.2em; background: none; } div.toolbar_O div.toolbar_I a.pageNotes { font-weight: bold; color: #0a3b3f; } div.toolbar_O div.toolbar_I a.pageNotes:hover { color: #FFF; } /* approve/reject btns */ div.toolbar_O div.userFunctions div.btnRHS a.btnApprove, div.toolbar_O div.userFunctions div.btnRHS a.btnReject { border: 1px solid #287e95; border-bottom: 2px solid #06465f; border-right: 2px solid #06465f; text-decoration: none; height: 12px; padding: 5px 15px 5px 0; background: #fffeff url(../images/interface/icon_approve.gif) 95% 3px no-repeat; display: -moz-inline-box; display: inline-block; color: #0a3b3f; } div.toolbar_O div.userFunctions div.btnRHS a.btnApprove:hover, div.toolbar_O div.userFunctions div.btnRHS a.btnReject:hover { background-color: #135d82; border: 1px solid #FFF; border-bottom: 2px solid #06465f; border-right: 2px solid #06465f; color: #FFF; } div.toolbar_O div.userFunctions div.btnRHS a.btnReject { background: #fffeff url(../images/interface/icon_reject.gif) 95% 3px no-repeat; } li.otherPageActions ul, li.otherPageActions ul li{ margin: 0; padding: 0; list-style: none; } Hello. So I have this situation (on the right): h t t p : / / img339.imageshack.us/img339/6958/1stb.png and when I change my browser resolution, I get this (on the right): h t t p : / / img35.imageshack.us/img35/3892/2ndhw.png Is it possible to do that the image wouldn't change the place on a screen even you when change the resolution of the browser? And yes, the image must be behind the text. Thanks in advance for any suggestions and tips. I'm attempting to use the Declaration of Independence as the background for my site. It is much longer than wide, but I want to display all of it. So I want the background to stop scrolling when the bottom of the image is reached at the bottom of the browser window while still allowing content to scroll on top of it. I have seen this done with a completely fixed background, but not with a partially scrolling background. Does anyone know how, or even if, this can be done? Need to know if it is possible to specify alt text for a fixed background image. background-image:url(cssback.gif); background-repeat:no-repeat; background-position:50px 355px; Any insight as to whether or not this is possible would be greatly appreciated. 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 Hey there! New to code, sort of flying blind but learning a lot as I go along. I'm also kind of shooting for the stars with my design decisions. I was wondering if anyone here has any idea how to mimic the rotating image on Blizzard's website. (As I cannot post the URL, I assume everyone can figure out how to get to Blizzard Entertainment's website easy enough). If you zoom in and out on it, it remains static even as the pieces around it resize over it (this also happens at smaller resolutions). I would desperately like to know how to get it to lock flush against the side of the window like that. Additionally, you'll notice that it doesn't pop a scrollbar onto the window until you shrink the window smaller than the central content. I guess a bigger question is, is this even something achievable in CSS? Do I have to delve into Flash or Javascript to do it, and if so, does anyone know how? Thank you so much in advance! I'm pretty new to using CSS so please be gentle I'm trying to hack (develop is to lofty a word at this point) this tableless page and get the bg image to stick to the right/top corner of the "content" div. IE6 renders it pretty well but Firefox (my preferred browser) is horrendous. The image size is 400x392. Any thoughts or a good reference on this would be greaty appreciated. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="generator" content="http://www.inknoise.com/experimental/layoutomatic.php" /> <style type="text/css"> #container { width: 760px; width: 780px; width: 760px; border: 1px solid gray; margin: 10px; margin-left: auto; margin-right: auto; padding: 10px; } #banner { padding: 5px; margin-bottom: 5px; background-color: rgb(213, 219, 225); } #content { padding: 5px; margin-left: 215px; background-color: gray; background-attachment: fixed; background-image: url(images/bg_run.jpg); background-repeat: no-repeat; height: 400px; background-position: right top; } #sidebar-a { float: left; width: 200px; \width: 210px; w\idth: 200px; margin: 0; margin-right: 5px; padding: 5px; background-color: rgb(235, 235, 235); } #footer { clear: both; padding: 5px; margin-top: 5px; background-color: rgb(213, 219, 225); } </style> </head> <body> <div id="container"> <div id="banner">Banner</div> <div id="sidebar-a">Sidebar</div> <div id="content">Content</div> <div id="footer">Footer</div> </div> </body> </html> 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 How can I fix a Div a set distance below another Div without a set height? I'm working inside of a classifieds software app and trying to position a button inside an area that I don't have access to the raw HTML. I built the image file and I know where I want it to appear on the page, but don't know the correct parameters to put in to get it there. I would like it to find the center of the page then go left 190 pixels and be about 400 pixels down from the top. Site is http://www.ineedihave.com. please look at this link http://sudhakargolakaram.co.in/image.html my question is how to place the image which has a curve design starting from the left till the right along with the 3 square images in between keeping this image aside the width of the wrapper is 825px which is fine the 1st div after the wrapper has content within the dark green at the very top and its width is the same as the wrapper which is 825px and the div after this are also 825px in order to have this curve image whose width is 1204px and height 266px as the 2nd div is what i need help with as of now my code is #wrapper { width: 825px; margin: 0 auto; } #contentwrapper{ float: left; width: 825px; height: 1900px; } #toprowouter{ float: left; width: 825px; height: 25px; } #menu{ float: left; width: 825px; height: 57px; color: #fff; } and code for other divs just for the sake of this 1 image with 1204 X 266 i guess it is really not needed to change the wrapper to #wrapper{ width: 1204px; margin: 0 auto; } and there after all the other divs will need to have a width of 1204px and i will have to apply padding on left and right to a container div so that the actual content will have a width of 825px how is it possible to have the image with 1204 X 266 sit inside the wrapper whose width is set to 825px or should i change the wrapper width to 1204px just because of this big image please provide the code for this thanks. I have the following Code: <td rowspan="2"> <img class="gallerypic" name="<?php echo $pic['filename']; ?>" src="pictures/thumbs/<?php echo $pic['filename']; ?>" width="<?php echo $pic['thumb_width']; ?>" height="<?php echo $pic['thumb_height']; ?>"> </td> <td> <div class="header">Caption</div> <div class="captionText">CaptionText</div> </td> I want the two div's to be positioned at the top of the TD they are in. I tried all different positioning stuff in thee CSS for their classes. What am I missing here? I really hate CSS sometimes. Do I need to style the TD to get this working? HTML -- CSS I decided my last layout looked like poop so I'm changing it. In FF the center logo fits right in the middle of the background image to give it a stretching effect. In IE the image is slightly above the baseline. (maybe 3-5 px) Any help here? |