Skip to content

Conversation

@dancormier
Copy link
Contributor

@dancormier dancormier commented Jan 9, 2026

This PR fixes a bug with our font sizing that had downstream effects on styles that leveraged our --s-full custom property. Previously, we were setting our base font size to a static 14px value at the html level. This resulted in values uses in classes such as our atomic static width/height classes to be inflated.

For example, check out the width of the .s-topbar--container in our docs:

image

Notice that it is 1361.23px wide. It has width: var(--s-full), which should result in a width of 1264px. With the changes in this PR, we get the intended width:

image

As a bonus, this simplifies our usage of rem values dramatically since sizing more often tends to be divisible by 16px (the default base font size set on the html tag - keep reading for more details on this). This should also make the upcoming atomic size class updates simpler 🤞

How this works

Standard browser default font size is 16px. By setting font-size: 100% on html, you're saying use 100% of the size of the browser's set font size. If the user overrides that font size, the user's preference will instead be applied.

On the body tag, a rem-based font size can be set. This will be relative to the font size set on html. Since the default is 16px, we can achieve our desired base font-size by setting the body font size to 0.825rem (which computes to 14px).

From MDN:

If a font-size has not been set on any of the <p>'s ancestors, then 1em will equal the default browser font-size, which is usually 16px. So, by default 1em is equivalent to 16px, and 2em is equivalent to 32px.[…]

Note

The above quote mentions em but the same logic applies to rem when operating at the body tag level.

Notable changes

  • As mentioned, html now has a font-size or 100%
  • I've replace the single usage of --fs-base with --fs-body1 and removed --fs-base altogether
  • I've fixed a bug where .s-prose of different sizes should have had font sizes that scaled relative to the parent's font size. We were using rem values when we should use em.
    • This also allowed me to remove all --fs-*-relative custom properties. They we're working as intended and were all either referenced in .s-prose or not at all
  • I've updated all rem values through our codebase to their base-16 equivelent values (this px to rem converter is handy if you'd like to check my math)

Other details

This should result nearly zero changes to the look of components (I think the .s-prose sizes are the most notable change). I'm relieved to see that the visual regression tests have passed 😅

How to test

I suggest hitting the local instance (or deploy preview) and just poking around a bunch. Notice that the docs site is no longer too wide. Verify that the font sizes compute to what is expected. Verify that any modified component still renders as expected.

For bonus points, try scaling your browser font size and notice the text scale with it (more work will need to be done in SPARK-154 to have all scaling live in harmony).

@dancormier dancormier added the do-not-merge Pull requests that are in progress and should not be merged yet label Jan 9, 2026
@changeset-bot
Copy link

changeset-bot bot commented Jan 9, 2026

🦋 Changeset detected

Latest commit: 87f7070

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Jan 9, 2026

Deploy Preview for stacks ready!

Name Link
🔨 Latest commit 87f7070
🔍 Latest deploy log https://app.netlify.com/projects/stacks/deploys/6961937e1dc31d000874f39d
😎 Deploy Preview https://deploy-preview-2119--stacks.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 9, 2026

Deploy Preview for stacks-svelte ready!

Name Link
🔨 Latest commit 87f7070
🔍 Latest deploy log https://app.netlify.com/projects/stacks-svelte/deploys/6961937ea04a7f000807ec7a
😎 Deploy Preview https://deploy-preview-2119--stacks-svelte.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@dancormier dancormier changed the title [WIP] fix(font-size): properly set rem values fix(font-size): properly set rem values Jan 9, 2026
@dancormier dancormier marked this pull request as ready for review January 9, 2026 23:51
Copy link
Contributor

@giamir giamir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Dan for taking the time to research and fix this issue. ❤️
It looks good to be merged for me.

@dancormier dancormier merged commit 85c14d4 into beta Jan 12, 2026
18 checks passed
@dancormier dancormier deleted the dcormier/rem-values-cleanup branch January 12, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge Pull requests that are in progress and should not be merged yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants