Source

Image Fit stack - usage examples


Cards 1

Using Image Fit stack to create consistently sized images at the top of 'cards'. Here we have set the height to be 200px and any image that we use (regardless of its shape and size) will crop to this height while still covering all of the available space and maintaining the aspect ratio of the image.

image

Item 1

Lorem ipsum dolor sit.

image

Item 2

Lorem ipsum dolor sit amet, sapien platea morbi dolor lacus nunc, nunc ullamcorper.

image

Item 3

Lorem ipsum dolor sit amet, sapien platea morbi dolor.

image

Item 4

Lorem ipsum dolor sit amet.


Image Grid

Here we are using Image Fit within a Grid Plus stack to create a grid of images. By using Image Fit, any images that are used in a grid item will (by default) fill all of the available space in that grid item. This means that we can create a perfect grid of images that scales perfectly.

image
image
image
image
image
image
image
image
image
image

Image Grid 2 (without Image Fit!)

This is the exact same Grid Plus set up as used in the previous example but this time we are using the regular Image stack as opposed to Image Fit. You'll see that there is a lot of gapping and it is much less neat.

image
image
image
image
image
image
image
image
image
image

Cards 2

A few more examples of creating 'card' type layouts. 3 of the 4 items have the Image Fit stack limiting the height of the image (to 200px on small screens and 300px on larger screens) while the other one fills all of the available space.

image

Item 1

Lorem ipsum dolor sit amet, sapien platea morbi dolor lacus nunc, nunc ullamcorper.

image

Item 2

Lorem ipsum dolor sit amet, sapien platea morbi dolor lacus nunc, nunc ullamcorper.

image
image

Item 3

Lorem ipsum dolor sit amet, sapien platea morbi dolor lacus nunc, nunc ullamcorper.


Cards 3

Here we have the image taking up all of the card (much in the same way as the image grid). Here we have also made use of the 'caption' option to make some additional content sit above the image! These items also have a hover effect added (and could obviously have a link added to them too!).

image

Item 1

image

Item 2

image

Item 3

image

Item 4

image

Item 5

Demo of Image Fit - a stack for Source 'micro' framework