Skip to main content

Overview

Media blocks handle visual content including images and videos. Horizon provides three media block types:
  1. Image Block - Static images with aspect ratio controls
  2. Video Block - Uploaded or external videos with playback options
  3. Media Block - Unified block supporting both images and videos

Image Block

Displays responsive images with aspect ratio control and optional linking.

Settings

image_picker
Image to display
Optional URL to link the image

Size Settings

select
default:"adapt"
Image aspect ratio
  • adapt - Use original image ratio
  • portrait - 4:5 ratio (taller)
  • square - 1:1 ratio
  • landscape - 16:9 ratio (wider)
select
default:"fill"
Desktop width behavior
  • fit-content - Fit to image size
  • fill - Fill available space
  • custom - Custom percentage
range
default:"100"
Custom width percentage (0-100%, visible when width is “custom”)
select
default:"fill"
Mobile width behavior
  • fit-content - Fit to image
  • fill - Fill container
  • custom - Custom percentage
range
default:"100"
Mobile custom width (0-100%)
select
default:"fit"
Height behavior (visible when image_ratio is “adapt”)
  • fit - Fit to content
  • fill - Fill container height

Border Settings

select
default:"none"
Border style (none or solid)
range
default:"1"
Border thickness (0-100px)
range
default:"100"
Border opacity (0-100%)
range
default:"0"
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

select
default:"uploaded"
Video source type
  • uploaded - Shopify-hosted video file
  • url - External video URL
video
Uploaded video file (visible when source is “uploaded”)
video_url
External video URL from YouTube or Vimeo (visible when source is “url”)
checkbox
default:"false"
Autoplay video on page load
checkbox
default:"true"
Loop video playback
image_picker
Custom cover/poster image (visible for external videos when autoplay is off)
text
Alternative text for accessibility (visible for external videos)

Size Settings

range
default:"100"
Desktop width (0-100%)
range
default:"100"
Mobile width (0-100%)
select
default:"auto"
Video aspect ratio (for external videos without cover image)
  • auto - Automatic
  • 9/16 - Portrait (9:16)
  • 1/1 - Square
  • 16/9 - Landscape (16:9)

Liquid Implementation

Media Block

Unified block that can display either an image or video based on settings.

Settings

select
default:"image"
Type of media to display
  • image - Static image
  • video - Video content
image_picker
Image to display (visible when media_type is “image”)
Link URL (visible when media_type is “image”)
video
Video file (visible when media_type is “video”)
checkbox
default:"true"
Loop video playback (visible when media_type is “video”)
checkbox
default:"false"
Autoplay video (visible when media_type is “video”)

Appearance Settings

checkbox
default:"true"
Inherit color scheme from parent section
color_scheme
default:"scheme-1"
Color scheme when not inheriting
range
default:"0"
Corner radius (0-100px)

Padding Settings

Standard padding controls for all four sides (0-100px).

Liquid Implementation

The media block uses the media snippet which handles the conditional rendering of images or videos.

Responsive Images

All image blocks use Shopify’s responsive image system:
This generates:
  • 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

Best Practices

Image Optimization

  1. Upload high-resolution images (at least 2000px wide)
  2. Use appropriate formats (WebP for photos, SVG for logos)
  3. Set alt text for accessibility
  4. Choose correct aspect ratio to avoid cropping

Video Performance

  1. Use autoplay sparingly - Can impact page performance
  2. Provide cover images - Faster initial load
  3. Consider file size - Compress videos before upload
  4. Use external URLs - YouTube/Vimeo for longer content

Responsive Design

  1. Set mobile widths - Different sizing for small screens
  2. Test aspect ratios - Ensure content looks good at all sizes
  3. Use adaptive ratios - When image proportions are important
  4. 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