Social cards in 1:1, 16:9, and 9:16 from one template
One HTML template, three aspect ratios, three MP4s. The container queries that make it work.
A campaign that ships to Instagram, TikTok, YouTube, LinkedIn, and X needs five aspect ratios from the same content. Most teams handle this with five After Effects files that get out of sync as the brand evolves. There is a faster path: one HTML template that responds to its container, three render passes.
The three aspects that cover most
The math: five common ratios collapse to three layout modes.
- 16:9 (YouTube, LinkedIn, X video) — wide hero, side-by-side type and visual.
- 1:1 (Instagram feed, X image) — stacked, type-heavy, central focus.
- 9:16 (Reels, TikTok, Stories) — vertical, large text, motion in the upper third.
Get these three right and you cover 95% of distribution.
Container queries do the work
The CSS feature that makes this possible: @container. Rather than checking the viewport, you check the element's size. The template wraps everything in a container; the children's layout responds to whatever aspect ratio that container has.
.frame { container-type: size; container-name: frame; }
@container frame (aspect-ratio > 16/10) {
.stage { grid-template-columns: 1fr 1fr; }
.type { font-size: 64px; text-align: left; }
}
@container frame (aspect-ratio < 1.1) and (aspect-ratio > .9) {
.stage { grid-template-columns: 1fr; }
.type { font-size: 72px; text-align: center; }
}
@container frame (aspect-ratio < 9/10) {
.stage { grid-template-rows: 1fr 1fr; }
.type { font-size: 84px; text-align: center; }
}Three media queries, three layouts. The renderer sizes the container per output; the layout follows.
The shared content
What stays the same across aspects:
- Headline copy
- Brand mark
- Color palette
- Animation timing
What changes:
- Grid direction (column vs row)
- Type scale
- Element ordering (logo above the headline on 9:16, beside it on 16:9)
If you find yourself changing the content between aspects, you have two templates, not one. Stop and rethink.
A concrete example
The same campaign card, rendered three ways:
Render specs per platform
The dimensions that matter, by platform:
| Platform | Aspect | Resolution | Duration |
|---|---|---|---|
| Instagram feed | 1:1 | 1080×1080 | up to 60s |
| Instagram Reels | 9:16 | 1080×1920 | 15-90s |
| TikTok | 9:16 | 1080×1920 | 15-180s |
| YouTube | 16:9 | 1920×1080 | any |
| YouTube Shorts | 9:16 | 1080×1920 | up to 60s |
| 1:1 or 16:9 | 1080×1080 or 1920×1080 | up to 10min | |
| X video | 16:9 | 1280×720 | up to 140s |
Pin these in your render configuration. A render at the wrong dimensions gets re-encoded by the platform, which means quality loss on top of the size loss.
The render matrix
In CI, the matrix is one row per (template, aspect) pair:
strategy:
matrix:
aspect: [1:1, 16:9, 9:16]
steps:
- run: pnpm render --template campaign.html --aspect ${{ matrix.aspect }} --out out/${{ matrix.aspect }}.mp4Three renders, three minutes total on a decent runner. Outputs upload to S3; the publishing tool picks the right MP4 for the right platform. See the GitHub Actions integration for the full workflow.
The brand-time benefit
The reason this is worth the upfront work: when the brand evolves, you fix one template. The next campaign ships in the new style across every aspect ratio simultaneously. No "we forgot to update the TikTok cut" Slack message. No "the YouTube version still has the old logo" thread.
For marketing teams shipping weekly, this compounds fast. The first month of one-template-many-aspects feels marginal. The third month, you stop noticing that the social cuts even need to be made. They are build artifacts.
The pattern lives outside of social, too — emails, landing pages, out-of-home — every surface gets a render at its native dimensions. Same source, many outputs. The static-site-generator playbook, for video.
Cite this postBibTeX · APA · Markdown
@misc{team2026social,
author = {HyperFrames Team},
title = {Social cards in 1:1, 16:9, and 9:16 from one template},
year = {2026},
url = {https://hyperframes.video/blog/social-media-cards-every-ratio},
note = {HyperFrames blog}
}HyperFrames Team. (2026, May 6). Social cards in 1:1, 16:9, and 9:16 from one template. HyperFrames. https://hyperframes.video/blog/social-media-cards-every-ratio
[Social cards in 1:1, 16:9, and 9:16 from one template](https://hyperframes.video/blog/social-media-cards-every-ratio) — HyperFrames Team, 2026
We build the deterministic HTML-to-video pipeline at HyperFrames. We write here when we have something concrete to say.
Generate App Store preview videos from HTML
Build an App Store preview video in HTML — phone-frame entrance, paginated screenshots, cross-faded captions — and render to deterministic MP4 at every required size.
Animated testimonial videos from JSON
A deterministic testimonial video template you can render from a JSON payload — avatar, quote, attribution, all frame-pinned MP4. The fastest testimonial video template for SaaS.
Animated funnel chart in HTML (no D3, no After Effects)
Build an animated funnel chart in plain HTML and CSS — stacked trapezoids, conversion percentages that count up, deterministic MP4 export. No charting library required.
Building with HyperFrames? Come hang out.
We're on GitHub, in Discord, and the playground is one click away. Bring weird ideas — we collect them.