tags:

views:

24

answers:

1

Hi,

I'm attempting to make a 2x2 grid with each cell 300x300px. Each cell has an image, which fades in and out, reloaded using AJAX ( jQuery to be precise) - creating a 4 image gallery over ajax. All images are simply dumped into a folder, so there is no defined height or width of them.

Is there any way by which I can have the fill the space? eg, a portrait shaped image would resize to height=300, while its width might be smaller... and similarly for a landscape image ( width=300 with smaller height)? I'm trying to eliminate any resizing of the cells, because it is rather horrible to watch.

I"ll leave centering these vertically and horizontally till later. Thanks for any help!

UPDATE: I've pastebin'ed the current code http://pastebin.com/Hz4fJk9p

+1  A: 

Use max-height:300px; and max-width:300px;, assuming your image is not smaller than 300px in both dimensions to begin with.

fredley
I've updated the original post with some code... The resize thing is working, however the height still scales. How do I have a fixed 300x300 grid? On my current example, the grid is aproz 250px heigh until a larger image fills the spot, pushing al other images/content down the page
PC_Nerd