Postcard Grid
The postcard layout consist of four images in a traditional layout for print. It is quite complex to make responsive using relative positioning and floats and a nightmare if you need the gaps to be adjustable.
Using the CSS Grid Layout Module to create the postcard is a breeze and the only item that requires more than basic CSS is the row gap. It needs to half the value of the collumn gap so that the images line up correctly and its value is figured by some CSS calc in the styles.
Structure
Each item in the grid is an HTML5 <figure> element with an image. The <figcaption> is inserted in an <article> element which creates a full size overlay with adjusable opacity. The overlay animates in on hover when viewed on computers and on page load when viewed on touch devices.
The caption is horizontally centered and, since the layout is a grid, can be vertically positioned at the top, center or bottom using the values "start", "center" or "end".
Images
The images should be cropped to the required size and aspect ratio before importing into EverWeb. The sizes of the images used in this demo are shown in the image caption.
Links
Images links are not very useful for responsive pages unless there is a caption or other means of letting the visitor know that the item is a link when they are viewing the page on a mobile device. In this case, the link is an SVG icon which appears on hover on computers and on page load on touch devices.
The links are turned on globally and can be configured to open internal or external pages and in a new window if required. The icon has controls for setting its size, color, opacity and hover color.
Animation
The overlay animates in using an opacity transition and the image can scale on hover if required. The animation time is set in milliseconds and the scale amout is set using a choice of preset values. The postcard on this page has the scale amount set to 1.15.
Break Point
As the device width gets too narrow to show the images in the postcard layout, they reposition themselves at the break point which can be set for tablet in landscape, tablet in portrait, phone in landscape and phone in portrait mode. There are controls for setting the grid gap and padding below the break point.