Overview
The Card block (_card.liquid) is a versatile container that supports background media (images or videos), overlay effects, and flexible content layouts. Cards can contain nested blocks and support various aspect ratios and alignment options.
Schema Definition
Supported Child Blocks
The card block accepts these nested block types:Configuration Settings
Layout Settings
Direction of content flow
column- Vertical layoutrow- Horizontal layout
Force vertical layout on mobile devices (when content_direction is “row”)
Horizontal alignment for row layouts
flex-start- Left alignedcenter- Center alignedflex-end- Right alignedspace-between- Distribute space between items
Vertical position for row layouts
flex-start- Topcenter- Centerflex-end- Bottom
Vertical position for column layouts
flex-start- Topcenter- Centerflex-end- Bottomspace-between- Distribute space
Spacing between child elements (0-100px)
Appearance Settings
Inherit color scheme from parent section
Color scheme when not inheriting (visible_if:
inherit_color_scheme == false)Background media type
none- No backgroundimage- Static imagevideo- Video background
Background image (visible when background_media is “image”)
Background video (visible when background_media is “video”)
Card aspect ratio (visible when background_media is set)
adapt- Auto (based on media)portrait- 2:3 ratiosquare- 1:1 ratiolandscape- 16:9 ratio
Overlay Settings
Enable media overlay
Overlay color with alpha support (visible when toggle_overlay is true)
Overlay style
solid- Solid colorgradient- Gradient effect
Gradient direction (visible when overlay_style is “gradient”)
to top- Bottom to top fadeto bottom- Top to bottom fade
Link Settings
Make entire card clickable
Open link in new tab
Padding Settings
Top padding (0-100px)
Bottom padding (0-100px)
Left padding (0-100px)
Right padding (0-100px)
Liquid Implementation
Basic Structure
Aspect Ratio Logic
CSS Classes
Main Classes
.card- Main container with overflow hidden and border radius.card__content- Content wrapper with z-index layering.card__inner- Flex container for child blocks.card__media-wrapper- Absolute positioned background media.card__link- Full-card clickable overlay
Utility Classes
.color-{scheme}- Color scheme variants.layout-panel-flex- Flexbox layout system.background-transparent- Transparent background for overlay effects
Usage Examples
Card with Background Image
Horizontal Card Layout
Clickable Card
Source Code Reference
View the complete implementation:/source/blocks/_card.liquid:1-533