CSS Image Postioning

Munkeypop

New Member
Hey folks,

I'm currently carrying out a page and I'm looking to position two images side by side, but I want there position to amend itself in relation to the width of the page. I've created my sites layout using fluid css, but wanted to see if anyone knows how I can get an image to always sit centrally on one side of the page.

In a nutshell, I want my image to sit so that it's horizontal center is positioned at 25% of the page width.

I've messed about with the "float" style, but can't seem to find a way round it. Any suggestions?
 

ChrisDN

New Member
CSS:
Code:
.your_class {
left: 25%;
margin-left: -100px;
position: relative;
}

HTML:

Code:
<img src="your_image.ext" width="200" height="100" class="your_class" />

Whatever the width of your img is, margin-left should be negative half of that value.
 
Last edited:
Top