...

View Full Version : Help with positioning icons with z-index: (very little code)



csshelp
12-08-2006, 09:14 PM
I would like my icons to always be in the same place, to the right, no matter what resolution. the site is not set to expand, it is "stuck"/specified at 780px wide.

How can I achieve this? The icons are currently 32x32 pixels.

Here is some code I hacked up, but it doesn't work the way I would like. Everytime the res is change the icons move out of the place I would like them to stay.

I hope this is clear, and can be done,
Thanks.


CSS code

#icons {
position:absolute;
z-index:10;
left:90%;
top:1px;
}

also here is my container code so you can get a better idea of whats going on.

#container {

width:760px;
border: 1px solid #000000;
margin: 0 auto;
height: auto;
}

Html Code

<div id="icons">
<img src="images/icon.gif" />
<img src="images/icon.gif" />
</div>

rmedek
12-09-2006, 12:29 AM
#container {
position: relative;
width:760px;
border: 1px solid #000000;
margin: 0 auto;
height: auto;
}

Absolutely positioned items are positioned relative to a relative container. Since their container (#container) wasn't declared relative, the icons were being placed relative to the browser window, which was moving all around.

p.s. Please don't use the "very little code" teasers in your titles. It's just annoying.

csshelp
12-09-2006, 12:44 AM
p.s. Please don't use the "very little code" teasers in your titles. It's just annoying.

Thanks, and sorry. I just figured i'd let people know what they were in for.

I will not use it in the title again.

Thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum