Skip to content

Centre the tutorial captions under their thumbnails - #27

Merged
cdiddens merged 1 commit into
pyoomph:mainfrom
cdiddens:center-scroller-captions
Aug 9, 2026
Merged

Centre the tutorial captions under their thumbnails#27
cdiddens merged 1 commit into
pyoomph:mainfrom
cdiddens:center-scroller-captions

Conversation

@cdiddens

@cdiddens cdiddens commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

On a phone the caption of each tutorial thumbnail sat left of the picture it belongs to, and wrapped into four short lines.

The cause is the browser's default figure { margin: 1em 40px }. It makes the caption box 80px narrower than the 200px thumbnail and offsets it 40px to the right. On wide screens the entry can grow to accommodate both, so image and caption still share a centre; below 600px the entry is capped at the image width, the image overflows the figure to the right, and the mismatch becomes visible.

  • drop that margin and pin the figure to the thumbnail width
  • the spacing between two thumbnails came from the very same margin: the declared gap: calc(var(--gap) / 2) never applied, because --gap is not defined anywhere and the declaration was therefore invalid at computed-value time. It is replaced by the 80px it was worth, so the desktop strip keeps exactly the width it had.

Checked with headless Chromium at 390px and 1200px against the current CSS: the desktop strip is unchanged apart from losing the stray 1em above and below, and on the phone the caption is centred under its thumbnail.

https://claude.ai/code/session_019CeqYuuPP1VTZ48tCNfcfF

The browser's default figure margin (1em 40px) made the caption box 80px
narrower than the 200px thumbnail and offset it 40px to the right. On wide
screens the entry could grow, so image and caption still shared a centre and
nothing looked wrong. On phones the entry is capped at the image width, the
image overflows the figure, and the caption ended up visibly left of the
picture it belongs to - and wrapped into four lines instead of two.

Drop that margin and pin the figure to the thumbnail width. The gap between
two thumbnails came from the very same margin, since the declared
gap: calc(var(--gap) / 2) never applied - --gap is not defined anywhere, so
the declaration was invalid at computed-value time. Replace it with the 80px
it was worth, which keeps the desktop strip exactly as wide as before.

Claude-Session: https://claude.ai/code/session_019CeqYuuPP1VTZ48tCNfcfF
@cdiddens
cdiddens merged commit b2a0fce into pyoomph:main Aug 9, 2026
1 check passed
@cdiddens
cdiddens deleted the center-scroller-captions branch August 9, 2026 06:04
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