Aspect ratios
One page renders at any whole W:H ratio. Lay out with CSS, never crop.
The aspectThe aspect is the width-to-height ratio of a film, such as 16:9, 9:16 or 1:1. is the width-to-height ratio of a film. A page renders at any ratio of two whole numbers, such as 16:9, 9:16, 1:1, 4:5, 4:3, 2:1 or 1200:630. You write the layout once in CSS, and the renderer gives it a different size.
Why it exists
One film often goes to several places: a wide player, a phone feed, a square post. A film that crops one canvas to fit another loses the edges of its layout. A film that lays out again for each canvas keeps every word and every mark in the frame. So the renderer never crops. It gives the page the size of the aspect, and the page lays itself out.
How it works
The renderer picks the aspect in this order. The first one that exists wins:
--aspect W:Hon a render verb.<meta name="aspect">in the page.16:9.
It then sets three things before your scripts run:
<html data-aspect="W:H">, for exampledata-aspect="9:16".--vwand--vhon:root, the width and height of the layout viewport as pixel lengths.window.vawe.aspect,window.vawe.widthandwindow.vawe.height.
The page sees an --aspect flag in the same way as the meta. A draft captures at half size, but the layout viewport has the full size, so a draft lays out exactly like a final.
Write the layout
Use --vh and --vw for sizes and [data-aspect] selectors for changes between aspects.
h1 { font-size: calc(var(--vh) * 0.11); }
[data-aspect="9:16"] h1 { left: 8%; top: 30%; }--vh holds a unit (for example 1920px). Write calc(var(--vh) * 0.11), never * 0.11px.
Render an aspect
bin/vawe dev films/<name>/page.html --aspect 9:16 # one draft
bin/vawe ship films/<name>/page.html --aspect all # one file for each of the five common aspects
bin/vawe dev films/<name>/page.html --aspect 2:1 # any whole W:H--aspect all renders the five aspects in the table below, one file each. Any other ratio gets its own flag value. The default output name gets the aspect (-2x1), so two aspects do not overwrite each other.
bin/vawe frame <page> --at 0 --size 1200x630 writes a PNG of that size. The size must have the ratio of the aspect, so pass --aspect 1200:630 with it.



Sizes
| aspect | final size |
|---|---|
16:9 | 1920 × 1080 |
9:16 | 1080 × 1920 |
1:1 | 1080 × 1080 |
4:5 | 1080 × 1350 |
4:3 | 1440 × 1080 |
any other W:H | 1920 px on the long edge |
Any ratio with equal sides, such as 3:3, gives 1080 × 1080. A draft is half the size of the table. The renderer rounds each side of the output to an even number, because the encoder refuses an odd side.
Limits
- A value that is not two whole numbers, such as
16/9or0:1, stops the render with an error that saysis not a W:H ratio of whole numbers. - Two aspects of one page are two separate renders. Each one is deterministicDeterminism means that the same page gives the same frames on every render, in any order. by itself. See Determinism.
The page
Text and fonts
Determinism
From the blogHTML video aspect ratio: 16:9, 9:16 and 1:1