Etch component

Card 2

Card with an image, a title link that covers the whole card, an optional excerpt, a date with an optional label and a text label on the right. It also makes the gallery card: "Updated" before the date and the photo count on the right.

Card 2

Copy Card 2

Configurator settings

Change a setting in the configurator to include it.

Optional. Copies the component under its own name, such as News Card Alpha for a site.

Documentation

The general-purpose card: an image, a title that links the whole card, an optional excerpt, a date and a text label on the right. With a few props it becomes a blog card or a gallery card.

How to use it

  • Fill in Title, Link, Image and Date. An empty Excerpt hides it.
  • For a gallery card, set Date Label to "Updated" and the CTA group's Label to the photo count, such as "24 photos". The configurator's presets show both uses.
  • The image's shape is a CSS recipe, below. Try one in the preview's Styles tab, then paste the one you pick in the site's main stylesheet.

Good to know

  • The title's link covers the whole card, so the label on the right is a MAC CTA 2 without a link. It turns --primary-hover when the card is hovered.
  • Dates read a YYYY-MM-DD value at noon UTC, so they show the right day on sites west of UTC.
  • See also MAC Card 1, a small link card with a title and an arrow, and MAC Card 3, with an icon, a logo or an image, a text and an action.

CSS recipes

--mac-card-2-media-ratio sets the image's shape, ACSS's card media ratio by default (16 / 9 here). --mac-card-2-title-lines and --mac-card-2-excerpt-lines set how many lines the title and the excerpt show (3), and --mac-card-2-hover-lift how far the card lifts on hover (1ch). A recipe on .mac-card-2 changes every Card 2 on the site, and on a grid's class, such as .gallery-grid .mac-card-2, only that grid's cards. Paste it in the site's main stylesheet, which Etch prints after the components' styles.

Photo shape

For photos and galleries, images in a camera's shape, 3 / 2.

/* Card 2's images in 3 / 2 */
.mac-card-2 {
  --mac-card-2-media-ratio: 3 / 2;
}

Classic shape

For images taller than the default, such as screenshots or illustrations, 4 / 3.

/* Card 2's images in 4 / 3 */
.mac-card-2 {
  --mac-card-2-media-ratio: 4 / 3;
}

Square images

For products, portraits or logos, square images.

/* Card 2's images square */
.mac-card-2 {
  --mac-card-2-media-ratio: 1 / 1;
}

Reference

Read from the component's JSON, so it's always current.

Loading the reference