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

Margin Calculated weirdly #40

Closed
ramsaylanier opened this issue Feb 16, 2015 · 1 comment
Closed

Margin Calculated weirdly #40

ramsaylanier opened this issue Feb 16, 2015 · 1 comment

Comments

@ramsaylanier
Copy link

As mentioned in #23, libsass interpolates some things weirdly. The proposed correction was to update _typeplate_function.scss as follow:

// $Context Calculator
// -------------------------------------//
// target / context = result
//
// @example             p { font-size: context-calc(24, 16, px); }

@function typl8-context-calc($scale, $base, $value) {
  @return #{$scale/$base}#{$value}; // chaining two interpolations
}


// $Measure-Margin
// -------------------------------------//
// divide 1 unit of measure by given font-size & return relative value
@function typl8-measure-margin($scale, $measure, $value) {
  $pixelValue: $measure/$scale;
  $remValue: $pixelValue * $typl8-font-base;

  @if $value == rem {
    @return #{$pixelValue}#{$value};
  } @else if $value == em {
    @return #{$remValue/$scale}#{$value};
  } @else {
    @return #{$remValue}#{$value};
  }
}

However, this was causing my Heading margins to be calculated backwards, meaning the H1 bottom margin was smaller than, say, and H3 as seen here.
screen shot 2015-02-16 at 1 03 24 pm

I found that by switching the $pixelValue calculation from $measure/$scale to $scale/$measure fixes the issue, I think?

screen shot 2015-02-16 at 1 07 14 pm

Is this....correct?

@justindietert
Copy link

The CSS version of Typeplate still uses the measure/scale method for calculating heading margins. I have found that this method produces a proper vertical rhythm for headings (in my opinion).

I just started using the SASS version, and the fix incorporated here has broken the vertical rhythm of my headings. There is now far too much space below a heading the larger that heading gets.

Perhaps the calculation should be switched back to $measure/$scale, as originally designed?

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