Template Customization

Master Layout Modifications

Your complete guide to modifying template layouts. Learn to position elements precisely, adjust sizing and spacing, leverage grid and flexbox layouts, and create responsive compositions that work across all aspect ratios.

Positioning Sizing Spacing Grid Flexbox Responsive
01

Understanding Layout Components

Learn the fundamental building blocks of template layouts and how they work together to create compelling compositions.

Rule

The Coordinate System

Remotion uses absolute positioning within a fixed canvas. The origin (0, 0) is at the top-left corner. All positions are measured in pixels from this point, with X increasing rightward and Y increasing downward.

Remotion Layout Documentation
Tip

Common Canvas Sizes

Choose your canvas size based on your target platform and content type.

FormatDimensionsAspect Ratio
1080p Landscape1920 × 108016:9
1080p Portrait1080 × 19209:16
Square1080 × 10801:1
4K Landscape3840 × 216016:9
Rule

Layout Containers

Templates organize content in nested containers. The root container matches the canvas size, while child containers group related elements. Understanding this hierarchy is key to making effective modifications.

Template Architecture Guide
This project

Before: Flat Structure

A flat layout with all elements at the same level makes it difficult to move groups of related content together or apply consistent styling.

This project

After: Nested Containers

Grouping related elements in containers (header, content, footer) enables you to move entire sections at once and apply consistent spacing within each group.

Tip

Identify Layout Layers

Most templates have three main layers: background (images, gradients), content (text, cards), and overlay (logos, watermarks). Each layer uses different positioning strategies.

02

Positioning and Alignment

Master precise element positioning with absolute coordinates, centering techniques, and edge alignment strategies.

Rule

Absolute Positioning

Use position: 'absolute' with left, top, right, or bottom values to place elements at exact pixel coordinates. This gives you precise control over element placement.

CSS Positioning Specification
This project

Before: Default Position

An element positioned at the default location may not align with your design intent.

  • position: 'absolute'
  • left: 100
  • top: 100
This project

After: Repositioned

Adjust coordinates to place the element exactly where you need it in your composition.

  • position: 'absolute'
  • left: 200
  • top: 150
Tip

Centering Elements

Center elements using the transform technique: set left: '50%' and transform: 'translateX(-50%)' for horizontal centering. Add top: '50%' and translateY(-50%) for vertical centering.

Rule

Edge Alignment

Align elements to canvas edges using right and bottom instead of left and top. This anchors elements to the opposite edges, useful for logos and watermarks.

Layout Best Practices
This project

Corner Positioning

Place elements in corners with consistent padding from the edges.

  • Bottom-right: right: 60, bottom: 60
  • Top-left: left: 60, top: 60
  • Top-right: right: 60, top: 60
  • Bottom-left: left: 60, bottom: 60
Tip

Z-Index Layering

Control stacking order with zIndex. Background elements use low values (0-10), content uses medium values (10-50), and overlays use high values (50+). This ensures elements appear in the correct order.

Rule

Safe Zones

Keep important content within safe zones—typically 60px from all edges. This prevents cropping on different platforms and ensures text remains readable when UI elements overlay the video.

Broadcast Safe Guidelines
03

Sizing and Spacing

Control element dimensions and spacing to create balanced, visually appealing compositions with proper breathing room.

Rule

Fixed Dimensions

Set explicit width and height values in pixels for precise control. This is ideal for elements that should maintain exact sizes regardless of content.

CSS Box Model
This project

Before: Default Size

An element at its default size may not fit your design requirements.

  • width: 400
  • height: 300
This project

After: Adjusted Size

Increase dimensions to give content more visual prominence.

  • width: 600
  • height: 400
Tip

Percentage-Based Sizing

Use percentages for responsive sizing: width: '100%' fills the container width, width: '50%' takes half. This adapts to different canvas sizes automatically.

Rule

Aspect Ratio Preservation

Maintain proportions when resizing with aspectRatio: '16 / 9'. Set one dimension and let the other calculate automatically. Essential for images and video containers.

CSS Aspect Ratio Property
Tip

Consistent Spacing Scale

Use a spacing scale for consistency: 8, 16, 24, 32, 48, 64, 96 pixels. Apply these values for padding, margins, and gaps. Consistent spacing creates visual rhythm and professionalism.

This project

Spacing Application

Apply spacing consistently across your layout for visual harmony.

  • Small gaps: 8-16px (between related items)
  • Medium gaps: 24-32px (between sections)
  • Large gaps: 48-64px (major separations)
  • Padding: 60px (from canvas edges)
Rule

Object Fit for Media

Control how images fill their containers with objectFit: 'cover' fills the container (may crop), 'contain' fits entirely (may letterbox), 'fill' stretches to fit.

CSS Object Fit Property
Tip

Max Width for Text

Limit text container width with maxWidth for better readability. Aim for 60-80 characters per line. For video, this typically means 600-900px depending on font size.

04

Grid and Flexbox Layouts

Leverage CSS Grid and Flexbox for flexible, powerful layouts that adapt to content and simplify complex arrangements.

Rule

Flexbox Basics

Flexbox arranges items along a single axis. Use display: 'flex' with flexDirection: 'row' for horizontal layouts or 'column' for vertical. Add gap for consistent spacing.

CSS Flexbox Specification
This project

Before: Stacked Elements

Elements stack vertically by default, requiring manual positioning for horizontal layouts.

This project

After: Flex Row

Flexbox creates a horizontal row with automatic spacing.

  • display: 'flex'
  • flexDirection: 'row'
  • gap: 20
  • alignItems: 'center'
Tip

Flex Alignment

Control alignment with justifyContent (main axis) and alignItems (cross axis). Common values: 'flex-start', 'center', 'flex-end', 'space-between', 'space-around'.

Rule

CSS Grid Basics

Grid creates two-dimensional layouts. Use display: 'grid' with gridTemplateColumns to define columns. repeat(3, 1fr) creates three equal columns.

CSS Grid Specification
This project

3-Column Grid

Create a responsive grid for card layouts or galleries.

  • display: 'grid'
  • gridTemplateColumns: 'repeat(3, 1fr)'
  • gap: 24
Tip

Asymmetric Grids

Create sidebar layouts with mixed column sizes: gridTemplateColumns: '300px 1fr' creates a fixed sidebar with flexible main content.

This project

Split Screen Layout

Use flexbox for equal split-screen compositions.

  • display: 'flex'
  • height: '100%'
  • Child 1: flex: 1
  • Child 2: flex: 1
Rule

When to Use Each

Use Flexbox for one-dimensional layouts (navigation bars, card rows, centered content). Use Grid for two-dimensional layouts (galleries, dashboards, complex page structures).

CSS Layout Best Practices
Tip

Nested Layouts

Combine Grid and Flexbox for complex layouts. Use Grid for the overall page structure, then Flexbox within individual cells for content alignment.

05

Responsive Considerations

Create layouts that adapt gracefully to different aspect ratios and canvas sizes for maximum flexibility.

Rule

Aspect Ratio Detection

Detect orientation by comparing width and height: const isPortrait = height > width. Use this to conditionally apply different layouts for landscape vs portrait compositions.

Responsive Design Principles
This project

Before: Fixed Layout

A layout designed for landscape may not work well when rendered in portrait orientation, with elements overlapping or extending beyond the canvas.

This project

After: Adaptive Layout

Conditional positioning adapts the layout based on aspect ratio.

  • left: isPortrait ? '50%' : 100
  • top: isPortrait ? 200 : '50%'
  • transform: isPortrait ? 'translateX(-50%)' : 'translateY(-50%)'
Tip

Content Scaling

Scale content proportionally with transform: scale(). Calculate scale factor: Math.min(width / 1920, height / 1080) to fit content designed for 1080p into any canvas size.

Rule

Platform-Specific Safe Zones

Different platforms have different UI overlays. Instagram/TikTok need larger top (120px) and bottom (180px) margins for usernames and captions. YouTube uses standard 60px margins.

Social Media Design Guidelines
Tip

Test Multiple Sizes

Always preview your layout at different aspect ratios before finalizing. Create test compositions at 16:9, 9:16, and 1:1 to ensure your layout adapts correctly.

This project

Responsive Text Sizing

Scale text based on canvas dimensions for consistent visual weight.

  • Base size: 48px at 1920 width
  • Scale factor: width / 1920
  • Responsive size: 48 * scaleFactor
Rule

Flexible vs Fixed Elements

Identify which elements should scale (backgrounds, containers) and which should remain fixed (logos, icons, minimum text sizes). This prevents tiny unreadable text or oversized UI elements.

Responsive Typography Guidelines
Tip

Breakpoint Patterns

Define layout breakpoints for major aspect ratio changes. Common patterns: stack vertically below 1:1, use sidebar above 4:3, full horizontal layout above 16:9.

Keep Learning

Related tips

Continue exploring with these related guides and tutorials.

Ready to modify your layouts?

Now that you understand layout principles, explore our template library to find templates with flexible layouts you can customize to your exact specifications.