• How to "anchor" pictures to the background?
    7 replies, posted
So I have a problem. I'm making a web page for a school assignment and I've encountered a pesky little problem. I have a good BG -image and I just started to put pictures that work as links to other pages. While doing this and finishing the placing etc.. I rezised the firefox window and all the pictures moved with the window. So basically what I need to know is that how do I make the pictures stick to the background without actually adding them to the background image? The picture placement is defined as [I]Fixed[/I].
Use [i]absolut[/i]. Always fixed to the page, put not the browser window. [editline]28th October 2010[/editline] Althought, they will move as you resize the window.
[QUOTE=pdkm931;25698287]Althought, they will move as you resize the window.[/QUOTE] You can set the parent tag/div to position: relative; to negate that effect. Beyond that, it'd probably help to see your markup, OP. [editline]17:40[/editline] Derp, disregard that disagree self-rating. Apparently I can't click the 'edit' button very well.
[QUOTE=pdkm931;25698287]Use [i]absolut[/i]. Always fixed to the page, put not the browser window.[/QUOTE] I think I tried that, but it didn't work. I wrote this code to my site: p.pos_fixed { position:fixed; top:30px; right:5px; } And changed the position to [I]absolute[/I], but it still couldn't alter itself to other resolutions or window sizes. I'll try this when I get back home, but I'm pretty sure it didn't work. @BrettJay So [I]relative[/I] would be the way to go then?
[QUOTE=Hullu V3;25698311]@BrettJay So [I]relative[/I] would be the way to go then?[/QUOTE] Say your images are in a div, set the images to be absolutely positioned, and the containing div to be relative. like this: #wrapper { width: 940px; margin: 0 auto; position: relative; } #wrapper img { position: absolute; top: whatever; left: whatever; } [editline]17:44[/editline] [url="http://css-tricks.com/absolute-positioning-inside-relative-positioning/"]Here's a better description[/url]. [editline]17:53[/editline] Actually, is there any reason you aren't using the box model (margin/padding) to position the images? If you're coding in hard values for positions, you're going to need to declare separate classes and their positions individually, which is less than ideal.
Don't you mean [i]position: relative; top: whatever; right: whatever;[/i] for the wrapper?
[QUOTE=pdkm931;25698362]Don't you mean [i]position: relative; top: whatever; right: whatever;[/i] for the wrapper?[/QUOTE] Yes you're right. Between self-rating disagree and typos everywhere, it's clear I'm not thinking straight today... :tinfoil:
Oh man, I can't figure it out even with your nice help. I have it like this now. [code] #Tarra { position:fixed; top:286px; right:750px; } /* This is the CSS style code */ <div id="Tarra"> <p><img src="Fotari/tarra.png" border=0 width="148" height="149" alt="tarra"/></p> </div> /* This is the HTML code that uses it */ [/code] If I put [I]relative[/I] to the spot where I now have [I]fixed[/I] the whole picture just disappears *poof* What am I doing wrong here?
Sorry, you need to Log In to post a reply to this thread.