Skip to content

Instantly share code, notes, and snippets.

@danyalette
Last active August 24, 2016 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danyalette/221d1e2f5aa5c547b3e5999c8e445262 to your computer and use it in GitHub Desktop.
Save danyalette/221d1e2f5aa5c547b3e5999c8e445262 to your computer and use it in GitHub Desktop.
/* assuming you are programmatically adding the following classes to the body:
- text-zoom-70
- text-zoom-100
- text-zoom-130
*/
@mixin font-size-accessible($font-size) {
font-size: $font-size;
/* define possible suffixes of text-zoom-[percent] body class */
$font-size-multipliers: 70 100 130;
@each $multiplier in $font-size-multipliers {
body.text-zoom-#{$multiplier} & {
font-size: $font-size*($multiplier/100);
/* if you are, conversely, trying to *reverse* a device's text zoom, do:
font-size: $font-size*(100/$multiplier);
*/
}
}
}
.icon {
@include font-size-accessible(14px);
}
.caption {
@include font-size-accessible(11px);
}
/* assuming you are programmatically adding the following classes to the body: - text-zoom-70 - text-zoom-100 - text-zoom-130
*/
.icon { font-size: 14px; }
body.text-zoom-70 .icon { font-size: 9.8px; }
body.text-zoom-100 .icon { font-size: 14px; }
body.text-zoom-130 .icon { font-size: 18.2px; }
.caption { font-size: 11px; }
body.text-zoom-70 .caption { font-size: 7.7px; }
body.text-zoom-100 .caption { font-size: 11px; }
body.text-zoom-130 .caption { font-size: 14.3px; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment