Skip to content

Use relative size for fonts and line-height #103

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

Merged
merged 3 commits into from
Apr 7, 2017

Conversation

DirtyF
Copy link
Member

@DirtyF DirtyF commented Jan 25, 2017

Fix #102

@ashmaroli
Copy link
Member

@DirtyF I think it would be better if we create a mixin for relative font sizes.. and related parameters ..
whatsay?

@DirtyF
Copy link
Member Author

DirtyF commented Jan 25, 2017

@ashmaroli I implemented your suggestion, we could also abstract values and use a typographic modular scale and make it easier for users to change typography for instance, but I don't feel like it's the intent of this theme.

@ashmaroli
Copy link
Member

I think you misunderstood my intent.
The reason I wanted this to be handled by a mixin was to avoid having to calculate and supply ratios...

I was thinking more along the lines of:
e.g.:

$base-font-size: 16; /* no units */

@mixin font-size($size) {
  font-size: 0px + $size; /* fallback for older-browsers */
  font-size: 0rem + $size / $base-font-size;
}
body {
  font-size: 0px + $base-font-size;
}

/* use mixin on all other elements. */
h1 {
  @include font-size(32) /* just the size in px. no units */
}

will yield:

h1 {
  font-size: 32px; /* fallback for older-browsers */
  font-size: 2rem;
}

@DirtyF
Copy link
Member Author

DirtyF commented Jan 26, 2017

yes I saw that codepen tutorial, we can go with rem unit, but my intent here was to gently move to a modular scale.

@ashmaroli
Copy link
Member

I was not aware of the modular scale even though it seems to have been around for years. Thank you for the links.
While I feel having to come up with the appropriate ratio is an added complexity for the user planning to customize the stylesheets, I'll leave it to your judgement.

@benbalter
Copy link
Contributor

@DirtyF which approach is better? This approach or the approach taken in #78? Not strongly opinionated. If you think this is the better approach, please resolve the merge conflicts.

@DirtyF
Copy link
Member Author

DirtyF commented Apr 7, 2017

@benbalter #78 was a good start, this PR applies the same principle to other font-size declarations. The mixin is just the way to keep it DRY.

@benbalter
Copy link
Contributor

@jekyllbot: merge +minor.

Thanks @DirtyF!

@jekyllbot jekyllbot merged commit f63da9d into jekyll:master Apr 7, 2017
jekyllbot added a commit that referenced this pull request Apr 7, 2017
@DirtyF DirtyF deleted the relative-font-size branch April 7, 2017 20:00
domingohui pushed a commit to domingohui/minima that referenced this pull request Apr 14, 2017
domingohui pushed a commit to domingohui/minima that referenced this pull request Apr 14, 2017
@jekyll jekyll locked and limited conversation to collaborators Apr 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blockquote hard-codes font size
4 participants