Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCSS reset breaks $doc-font-size scaling #4983

Closed
karmaniverous opened this issue Sep 19, 2024 · 1 comment
Closed

SCSS reset breaks $doc-font-size scaling #4983

karmaniverous opened this issue Sep 19, 2024 · 1 comment

Comments

@karmaniverous
Copy link

karmaniverous commented Sep 19, 2024

Theme version and system environment

  • Minimal Mistakes version:
  • Ruby gem or remote theme version:
  • Jekyll version:
  • Git repository URL:
  • URL to the page with the problem:
  • Operating system:
  • Browser version:

What happened?

I want to use $doc-font-size to scale all text in the theme, but the html style in _reset.scss is overriding my change.

Expected behavior

Changing $doc-font-size should alter font sizes globally. It does not.

Steps to reproduce the behavior

Go to _variables.scss and change $doc-font-size, then observe the effect on the text in a post.

Other

It's pretty clear what is happening here.

All of the type scaling variables are based on em sizes, which are set by the most recent absolute font size setting. In _reset.scss we have this:

html {
  /* apply a natural box layout model to all elements */
  box-sizing: border-box;
  background-color: $background-color;
  font-size: 16px;

  @include breakpoint($medium) {
    font-size: 18px;
  }

  @include breakpoint($large) {
    font-size: 20px;
  }

  @include breakpoint($x-large) {
    font-size: 22px;
  }
 
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

So the scaling basis will always be 16, 18, 20, or 22px, no matter what is set in the SCSS variables.

@karmaniverous
Copy link
Author

I resolved this by adding the following to assets/css/main.scss:

html {
  /* apply a natural box layout model to all elements */
  box-sizing: border-box;
  background-color: $background-color;
  font-size: $doc-font-size * 1px;

  @include breakpoint($medium) {
    font-size: $doc-font-size * 1.125px;
  }

  @include breakpoint($large) {
    font-size: $doc-font-size * 1.25px;
  }

  @include breakpoint($x-large) {
    font-size: $doc-font-size * 1.375px;
  }

  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

@iBug iBug closed this as completed Sep 19, 2024
@iBug iBug reopened this Sep 19, 2024
@iBug iBug closed this as completed in 6be43f7 Sep 19, 2024
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

No branches or pull requests

2 participants