tags:

views:

70

answers:

4

** Edit 3:**

Another example of what I try to achive:

+--------------------+
|                    |
|  +--++--++--++--+  |
|  |1 ||2 ||3 ||4 |  |
|  |  ||  |+--+|  |  |
|  +--+|  |+--+|  |  |
|  +--+|  ||7 |+--+  |
|  |5 |+--+|  |+--+  |
|  |  |+--+|  ||8 |  |
|  |  ||6 ||  |+--+  |
|  +--+|  |+--+      |
|      +--+          |
|                    |
+--------------------+

Code:

<body> 8x <img /> </body>

CSS:

?

Hello,

I have 3 images in an HTML page which displays like this: (basically, in code, it's just three <img /> in a row)

+------------------+
|                  |
|  +---++-------+  |
|  |1  ||2      |  |
|  |   ||       |  |
|  +---+|       |  |
|       |       |  |
|       +-------+  |
|  +--+            |
|  |3 |            |
|  |  |            |
|  +--+            |
|                  |
+------------------+

But I would like it to show without the vertical gap between 2nd and 3rd one, like:

+------------------+
|                  |
|  +---++-------+  |
|  |1  ||2      |  |
|  |   ||       |  |
|  +---+|       |  |
|  +--+ |       |  |
|  |3 | +-------+  |
|  |  |            |
|  +--+            |
|                  |
|                  |
|                  |
+------------------+

How to? Is it somehow possible to do this CSS?

Edit:

In other words, I want the 3rd image to touch the 1st one, as there clearly is some space left. But whan the screen is not large enough, the 3rd "reflows" (is this the right word?) to the next line which maintains the height of heighest element from the line above. And I don't want it to maintain the height, I want it to fit closely together..

Edit 2:

code:

<html><body>
<img /><img /><img />
</body><html>

It's really just a few images in a row......

A: 

Put images 1 and 3 first in your HTML and add the attribute align="left" to them.

Alternatively, you can use CSS position:absolute and set explicit X,Y coordinates for each one.

elmonty
Wow. I haven't seen `align="left"` since like 2001
Josh Stodola
A: 

Actually it would be easier if you could show some code... but you can position images like that

.image1{
     position:fixed;
     right:20px;
     top:50px;
}

.image2{
   position:fixed;
     right:100px;
     top:50px;
}

and experiment with position you acually want accordingly to the size of your images...

or you could present them as background images like that:

.something {
    background-image:url(yourpath.jpg);
    position:fixed;
    top:711px;
        left:10px;
    display:block;
    height:100px;
    width:269px;
}

fixed position is not always the best way to go but it may work in your case...

try googling css images and you can find a lot of things... also this is a good resource: http://www.opera.com/company/education/curriculum/

and this is a really helpful css cookbook http://www.amazon.com/CSS-Anthology-Essential-Tricks-Hacks/dp/0980576806

good luck

rabidmachine9
`position: absolute;` will probably be less confusing than `position: fixed;`.
strager
A: 

If you know the images ahead of time, then I don't understand why you need a general solution. jnkrois gave a good answer for a specific case.

If you want a general solution, I would position them all absolute, and use javascript to calculate the location at runtime. Essentially then you're looking for a packing algorithm, which you could find in a variety of places.

joelt
Even if I know the images ahead of time, I don't know browser width so they might reflow. Yes, I could check for browser resize in javascript and then pack the images but it feel a bit unbelievable that it can't be done it pure CSS.
Theo Heikonnen
+1  A: 

You should try Masonry jQuery plugin. Take a look on the plugin page you should see an example of what you want to achieve: http://desandro.com/resources/jquery-masonry/

andreeib