Skip to content

Size the README animations in pixels so they fill the width on phones - #504

Merged
basnijholt merged 1 commit into
mainfrom
t3/readme-mobile-animations
Nov 16, 2026
Merged

basnijholt merged 1 commit into
mainfrom
t3/readme-mobile-animations

Conversation

@basnijholt

Copy link
Copy Markdown
Member

Summary

The README animations had percentage widths (43% / 36% / 19%), so on a phone each one got a fraction of a ~330 px column: the Learner1D GIF rendered at 139 × 63 px and the LearnerND one at 62 × 62 px.

They now have pixel widths with the same 160 px height (356 / 299 / 160 px). On desktop they still sit in one row, since GitHub's README column is 838 px. On narrower screens GitHub's img { max-width: 100% } lets each one wrap to its own row at up to the full column width.

GitHub strips style, so the media-query approach the docs home page uses (docs/_static/extra.css) is not available here. I also tried <picture><source media=... srcset="... 2.25x"> to change the size per breakpoint, but GitHub's camo proxy folds the 2.25x descriptor into the proxied URL, which breaks the image.

Image sizes measured with Playwright on the rendered repository page, main versus this branch:

Viewport main this branch
desktop ≥ 1280 px (README column 838 px) 360 / 302 / 159 px, one row 356 / 299 / 160 px, one row
desktop 1100 px (column 658 px) 283 / 237 / 125 px, one row 356 px, then 299 + 160 px on a second row
iPhone 13 (column 324 px) 139 / 117 / 62 px 324 / 299 / 160 px, stacked

docs/index.md has its own copy of the markup and CSS for phones, so the docs site is unchanged.

Test plan

  • Rendered the branch's repository page in Chromium at 1280 px, 1100 px and with iPhone 13 emulation and compared the image sizes with main
  • Check the README in the GitHub mobile app after merging

The widths were percentages of the README column, so on a phone each GIF got
a fraction of ~360 px (the Learner1D one ended up ~150 px wide). With pixel
widths of the same 160 px height, the three still sit in one row on desktop
(815 of GitHub's 838 px), while on phones GitHub's `max-width: 100%` lets each
one wrap to its own row at up to the full column width.
@basnijholt
basnijholt merged commit 1216b97 into main Nov 16, 2026
17 of 18 checks passed
@basnijholt
basnijholt deleted the t3/readme-mobile-animations branch November 16, 2026 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant