Wells-it.com - Web Hosting

CSS layout problem

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

They have: 11 posts

Joined: Jan 2006

Im having a small problem with a image that I'm floating left which is right next to another image I'm floating right. When the browser window is resized smaller, the image on the right moves underneath the left image. Here is the site:

http://tanismedia.net/tanistemplate.html

Is there any way to prevent this?

Thanks

timjpriebe's picture
DeveloperModeratorSponsor

He has: 2,666 posts

Joined: Dec 2004

I'm not sure if there's a way to directly prevent that, but another option is to make one of the images a background image of a div, and then float the other image within that div.

demonhale's picture

He has: 3,301 posts

Joined: May 2005

hey try two float lefts, one for the first image and another for the second, if not try using a single div wrap it to the two img tags and just directly assign tags with no floats and the div will float aorund, but the two images will stick together...

Renegade's picture
Moderator

He has: 2,944 posts

Joined: Oct 2002

This is the way it is meant to work, if you don't like this, don't float both objects. Try doing something like this:

#left-image {
position:relative;
margin:0;
padding:0;
float:left;
width:10em;
}

#right-image {
position:relative;
margin:0 0 0 10em;
padding:0;
}

'

And of course the HTML:

<div id="left-image">
<img src="left-image.gif" width="100" height="100" alt="" title="" />
</div>
<div id="right-image">
<img src="right-image.gif" width="100" height="100" alt="" title="" />
</div>

'

I haven't tested the code but, try it and see if it works.

Cheng Eu Chew - Renegade
Download:
- Mozilla, Firefox
- Opera
This post may contain peanut traces