Helpers
In this module you can find various mixins which help you with often used tricks and styles. Also mixins for targeting few browsers and SCSS functions for recalculating units.
File
lightingfly/modules/_helpers.scss
Links
Specification for CSS3 colors.: w3.org
Specification for user-select.: developer.mozilla.org
Specification for CSS units.: w3.org
Text-overflow at css-tricks.: css-tricks.com
Understanding visually hidden.: http://websiteaccessibility.donaldevans.com
color
Fallback mixin for unsupported colors for text.
Mixin
@mixin color($color-fallback, $color)
Arguments
$color-fallback:
[#000, rgb(0,0,0), ...]
- fallback for unsuported color$color:
[rgba(0,0,0,0.5), ...]
- color
Usage example
Demo
Element with semi-transparent text color and fallback color for old browsers
font-size
Mixin for recaltulating font-size in pixels to rem, including fallback.
Mixin
@mixin font-size($font-size, $font-size-root)
Arguments
$font-size:
[12px, ...]
- expected font size in pixels$font-size-root:
[16px, ...]
- root font size
Usage example
Demo
Element with font-size in rem units.
_get-em
Function that returns value in em units calculated from pixels and font-size.
Function
_get-em($size, $font-size);
Arguments
$size:
[12px, ...]
- expected size in pixels$font-size-:
[16px, ...]
- font size from which size will be calculated
Usage example
Demo
Element with width and height defined in ems.
_get-rem
Function that returns value in rem units calculated from pixels and root's font-size.
Function
_get-rem($size, $font-size-root);
Arguments
$size:
[12px, ...]
- expected size in pixels$font-size-root:
[16px, ...]
- root font size from which size will be calculated
Usage example
Demo
Element with width and height defined in rems.
apply-to-webkit
Mixin which ensure that following CSS rules would be used only in browsers using webkit.
Mixin
@mixin apply-to-webkit{ @content };
Arguments
@content:
[text]
- CSS rules
Usage example
Demo
This element has green background for browsers using webkit and blue background for other browsers.