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
select
default:"column"
Direction of content flow
column- Vertical layoutrow- Horizontal layout
checkbox
default:"true"
Force vertical layout on mobile devices (when content_direction is “row”)
select
default:"flex-start"
Horizontal alignment for row layouts
flex-start- Left alignedcenter- Center alignedflex-end- Right alignedspace-between- Distribute space between items
select
default:"center"
Vertical position for row layouts
flex-start- Topcenter- Centerflex-end- Bottom
select
default:"center"
Vertical position for column layouts
flex-start- Topcenter- Centerflex-end- Bottomspace-between- Distribute space
range
default:"12"
Spacing between child elements (0-100px)
Appearance Settings
checkbox
default:"true"
Inherit color scheme from parent section
color_scheme
default:"scheme-1"
Color scheme when not inheriting (visible_if:
inherit_color_scheme == false)select
default:"none"
Background media type
none- No backgroundimage- Static imagevideo- Video background
image_picker
Background image (visible when background_media is “image”)
video
Background video (visible when background_media is “video”)
select
default:"adapt"
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
checkbox
default:"false"
Enable media overlay
color
default:"#00000026"
Overlay color with alpha support (visible when toggle_overlay is true)
select
default:"solid"
Overlay style
solid- Solid colorgradient- Gradient effect
select
default:"to top"
Gradient direction (visible when overlay_style is “gradient”)
to top- Bottom to top fadeto bottom- Top to bottom fade
Link Settings
url
Make entire card clickable
checkbox
default:"false"
Open link in new tab
Padding Settings
range
default:"0"
Top padding (0-100px)
range
default:"0"
Bottom padding (0-100px)
range
default:"0"
Left padding (0-100px)
range
default:"0"
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