Overview
Media blocks handle visual content including images and videos. Horizon provides three media block types:- Image Block - Static images with aspect ratio controls
- Video Block - Uploaded or external videos with playback options
- Media Block - Unified block supporting both images and videos
Image Block
Displays responsive images with aspect ratio control and optional linking.Settings
Image to display
Optional URL to link the image
Size Settings
Image aspect ratio
adapt- Use original image ratioportrait- 4:5 ratio (taller)square- 1:1 ratiolandscape- 16:9 ratio (wider)
Desktop width behavior
fit-content- Fit to image sizefill- Fill available spacecustom- Custom percentage
Custom width percentage (0-100%, visible when width is “custom”)
Mobile width behavior
fit-content- Fit to imagefill- Fill containercustom- Custom percentage
Mobile custom width (0-100%)
Height behavior (visible when image_ratio is “adapt”)
fit- Fit to contentfill- Fill container height
Border Settings
Border style (
none or solid)Border thickness (0-100px)
Border opacity (0-100%)
Corner radius (0-100px)
Padding Settings
Standard padding controls (0-100px) for all four sides.Liquid Implementation
CSS Classes
.image-block- Main container with flex display.image-block__image- Image element with object-fit cover.image-block--height-fill- Fills parent height.placeholder-image- Placeholder when no image selected.border-style- Border styling utilities
Video Block
Supports both uploaded videos and external video URLs (YouTube, Vimeo).Settings
Video source type
uploaded- Shopify-hosted video fileurl- External video URL
Uploaded video file (visible when source is “uploaded”)
External video URL from YouTube or Vimeo (visible when source is “url”)
Autoplay video on page load
Loop video playback
Custom cover/poster image (visible for external videos when autoplay is off)
Alternative text for accessibility (visible for external videos)
Size Settings
Desktop width (0-100%)
Mobile width (0-100%)
Video aspect ratio (for external videos without cover image)
auto- Automatic9/16- Portrait (9:16)1/1- Square16/9- Landscape (16:9)
Liquid Implementation
Media Block
Unified block that can display either an image or video based on settings.Settings
Type of media to display
image- Static imagevideo- Video content
Image to display (visible when media_type is “image”)
Link URL (visible when media_type is “image”)
Video file (visible when media_type is “video”)
Loop video playback (visible when media_type is “video”)
Autoplay video (visible when media_type is “video”)
Appearance Settings
Inherit color scheme from parent section
Color scheme when not inheriting
Corner radius (0-100px)
Padding Settings
Standard padding controls for all four sides (0-100px).Liquid Implementation
media snippet which handles the conditional rendering of images or videos.
Responsive Images
All image blocks use Shopify’s responsive image system:- Multiple image sizes in
srcset - Automatic size selection based on viewport
- Lazy loading support
- Optimal performance
Usage Examples
Hero Image
Looping Background Video
YouTube Embed
Gallery Layout
Best Practices
Image Optimization
- Upload high-resolution images (at least 2000px wide)
- Use appropriate formats (WebP for photos, SVG for logos)
- Set alt text for accessibility
- Choose correct aspect ratio to avoid cropping
Video Performance
- Use autoplay sparingly - Can impact page performance
- Provide cover images - Faster initial load
- Consider file size - Compress videos before upload
- Use external URLs - YouTube/Vimeo for longer content
Responsive Design
- Set mobile widths - Different sizing for small screens
- Test aspect ratios - Ensure content looks good at all sizes
- Use adaptive ratios - When image proportions are important
- Add padding - Provide breathing room on mobile
Source Code Reference
- Image Block:
/source/blocks/image.liquid:1-331 - Video Block:
/source/blocks/video.liquid:1-255 - Media Block:
/source/blocks/_media.liquid:1-135