How to stack images on top of each other when images are Floating?


We offer a free Blog service, and one of the features of this free blog service is that you can have your fotos that you have added to your Blog show via the Light Box effect.

And we use
<div class=“image-float-right”>
to for example float the images on the right side, if the user has chosen to display them on the top right side.

However if there are more than 1 images being floated right, rather than them stacking on top of each other, they are being placed next to each other which is not what should be.

For an example, take a look at this user Blog:

As you can see the images rather than being stacked on top of each other, are seating to next each other. Now you can imagine how bad it will be if there are 5 such images.

So using the
<div class=“image-float-right”>
how do we get them to stack up right on top of each other?


Do you mean actually on top of one another so only the top most one displays or do you mean down the right side of the screen?

For the first of these you’d need to use position:absolute

For the second the easiest way is probably to place the images inside a container and float that right instead of the individual images.

You could have that calss add a “clear:right” :).

Untested though.


Yes, I mean the 2nd one. That is have the fotos all aligned on top of each
other down the right side. Of course the user can have the option of
having them go across, as they like. But for this discussions purpose
I am looking for the solution to have the fotos aligned down the right side.

So how doese one “place the images inside a container”?
I mean is that a CSS thing? or what?


You already have a class set up in style_blog.css to float the images and you could just add clear:right to it.


.image-float-right  {
border:2px solid  #000000;
margin:5px 2px 10px 15px;


Or set up a similar new class if its just for that section only.


It is amazing, it is now working OK.
I mean I had the clear:right; in there but it was below float:right;
and it was not working Ok, once I moved it above it is working OK!
Did not know that it was this sensitive!!!


No it doesn’t :slight_smile:

<!doctype html>
float:right;/*switch these up*/

Order of properties doesn’t matter (most of the time, anyways)