Skip to content

Commit

Permalink
Remove font-size fallback from mixin in favour of rem (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakemulley authored and joshuawaheed committed Mar 28, 2018
1 parent 54840e0 commit f00f3df
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/stylesheets/elements/_body.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@import '../elements/semantic-elements';

html {
font-size: 16px;
font-size: $base-font-size;
}

body {
Expand Down
1 change: 1 addition & 0 deletions src/stylesheets/settings/_fonts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
}

$base-font-stack: 'National', Arial, 'Helvetica Neue', Helvetica, sans-serif;
$base-font-size: 16px;
8 changes: 5 additions & 3 deletions src/stylesheets/settings/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

/*--- Font Size [size] Pass Pixel value to get REM/Pixel fallback ---*/

@mixin fontsize($size){
font-size: $size + 0px;
font-size: ($size / 16) + 0rem;
@mixin fontsize($size) {
/* If you divide a united value ($base-font-size) by 1px, it becomes unitless.
Since you cannot merge two units (px and rem, in this case), you have to make one unitless.
*/
font-size: ($size / ($base-font-size / 1px)) + 0rem;
}

/*--- Border Radius [top left, top right, bottom right, bottom left] ---*/
Expand Down

0 comments on commit f00f3df

Please sign in to comment.