Configuration—General
variables
default-browser-font-size
$default-browser-font-size: 16 !default;Description
Default browser font size in pixels
Used to calculate conversions between different units
Type
Number
Used by
- [function]
_px-to-rem - [function]
_rem-to-px - [function]
_percent-to-px - [function]
_px-to-percent - [function]
_line-height
Author
Jared Howland
breakpoints
$breakpoints: (
bp-0: (
breakpoint: 0, // Mobile first
font-size: 16px 18px,
line-height: 1.5,
modular-scale: golden
),
bp-1: (
breakpoint: 480px, // ~ Extra small screen up
font-size: 18px 20px,
line-height: 1.5,
modular-scale: golden
),
bp-2: (
breakpoint: 768px, // ~ Small screen/tablet up
font-size: 20px 22px,
modular-scale: golden // no line-height specified so scale is used
),
bp-3: (
breakpoint: 992px, // ~ Medium screen up
font-size: 22px 24px,
modular-scale: golden // no line-height specified so modular-scale is used
),
bp-4: (
breakpoint: 1200px, // ~ Desktop up
font-size: 24px 26px,
modular-scale: golden // no line-height specified so modular-scale is used
)
) !default;Description
Map of various breakpoints
Type
Map
Map structure
| Map keyName | Map keyDescription | Map keyType | Map keyValue |
|---|---|---|---|
<Breakpoint-Name> | Required. Name of first breakpoint. | Map | —none |
<Breakpoint-Name>.breakpoint | Required. Minimum width at which to apply these values | Number | —none |
<Breakpoint-Name>.font-size | Required. Space-separated list of all | List | —none |
<Breakpoint-Name>.line-height | Required. Unitless | Number | —none |
<Breakpoint-Name>.modular-scale | Optional. Name of modular scale to use (must be defined in | String | —none |
<Other-Breakpoints> | Other breakpoints defined just like | Map | —none |
Used by
- [function]
_line-height - [mixin]
_breakpoint - [mixin]
_height - [mixin]
_padding-margin - [mixin]
_padding-margin-individual - [function]
_get-bp-names - [function]
_get-bp-data - [mixin]
rhythm
Author
Jared Howland
modular-scales
$modular-scales: () !default;Description
Map of various custom scales
Creating a custom map of scales will add scales to the map structure described below rather than simply overriding them so that both the custom and built-in scales are always available for use
Type
Map
Map structure
| Map keyName | Map keyDescription | Map keyType | Map keyValue |
|---|---|---|---|
golden | —none | Number | 1.618 |
minor-second | —none | Number | 1.067 |
major-second | —none | Number | 1.125 |
minor-third | —none | Number | 1.2 |
major-third | —none | Number | 1.25 |
perfect-fourth | —none | Number | 1.333 |
augmented-fourth | —none | Number | 1.414 |
perfect-fifth: | —none | Number | 1.5 |
minor-sixth | —none | Number | 1.6 |
major-sixth | —none | Number | 1.667 |
minor-seventh | —none | Number | 1.778 |
major-seventh | —none | Number | 1.875 |
octave | —none | Number | 2 |
major-tenth | —none | Number | 2.5 |
major-eleventh | —none | Number | 2.667 |
major-twelfth | —none | Number | 3 |
double-octave | —none | Number | 4 |
Example
Defining custom scale(s)
$modular-scales: (
my-scale-1: 1.1,
my-scale-2: 1.3
);Used by
- [function]
_modular-scale-value
Author
Jared Howland
Configuration—Colors
variables
background-color
$background-color: #f5f5f5 !default;Description
Color of background for page
Type
Color
Author
Jared Howland
code-background-color
$code-background-color: darken($background-color, 7%) !default;Description
Color of background for code snippets
Type
Color
Author
Jared Howland
heading-color
$heading-color: #2e2e2e !default;Description
Color for text of headings
Type
Color
Author
Jared Howland
body-color
$body-color: #444 !default;Description
Color for text of body
Type
Color
Author
Jared Howland
body-color-muted
$body-color-muted: #ccc !default;Description
Muted color for text
Type
Color
Author
Jared Howland
link-color
$link-color: #265c83 !default;Description
Color for links
Type
Color
Author
Jared Howland
link-hover-color
$link-hover-color: lighten($link-color, 10%) !default;Description
Color for links when hovered
Type
Color
Author
Jared Howland
link-background-color
$link-background-color: transparent !default;Description
Color for background of links
Type
Color
Author
Jared Howland
Configuration—Fonts
variables
serif-font-family
$serif-font-family: Georgia, serif !default;Description
Default serif font family
Type
List
Author
Jared Howland
sans-serif-font-family
$sans-serif-font-family: Helvetica, sans-serif !default;Description
Default sans-serif font family
Type
List
Author
Jared Howland
monospace-font-family
$monospace-font-family: Menlo, monospace !default;Description
Default monospace font family
Type
List
Author
Jared Howland
body-font
$body-font: $serif-font-family !default;Description
Default font family for body
Type
List
Author
Jared Howland
heading-font
$heading-font: $sans-serif-font-family !default;Description
Default font family for headings
Type
List
Author
Jared Howland
code-font
$code-font: $monospace-font-family !default;Description
Default font family for code
Type
List
Author
Jared Howland
Configuration—Typography
variables
indent-value
$indent-value: 1rem !default;Description
Indent value for paragraphs
Type
Number
Author
Jared Howland
dropcap-float-position
$dropcap-float-position: left !default;Description
Float position for drop caps. Valid values: none, left, right, initial, or inherit.
Type
String
Author
Jared Howland
dropcap-font-size
$dropcap-font-size: 4em !default;Description
Font size for drop caps.
Type
Number
Author
Jared Howland
dropcap-font-family
$dropcap-font-family: inherit !default;Description
Font family for drop caps.
Type
List
Author
Jared Howland
dropcap-txt-indent
$dropcap-txt-indent: 0 !default;Description
Indent size for drop caps.
Type
Number
Author
Jared Howland
dropcap-margin
$dropcap-margin: 10px 10px 0 0 !default;Description
Margin for drop caps.
Type
Number or List
Author
Jared Howland
dropcap-padding
$dropcap-padding: 0 20px !default;Description
Padding for drop caps.
Type
Number or List
Author
Jared Howland
dropcap-color
$dropcap-color: inherit !default;Description
Color for drop caps.
Type
Color
Author
Jared Howland
dropcap-line-height
$dropcap-line-height: 1 !default;Description
Line height for drop caps.
Type
Number
Author
Jared Howland
dropcap-bg
$dropcap-bg: transparent !default;Description
Background for drop caps.
Type
String
Author
Jared Howland
General
mixins
rhythm
@mixin rhythm() { ... }Description
Initializes Rhythm by looping through all breakpoints and setting default classes, font-sizes, and line-heights
Parameters
None.
Output
font-sizes, line-heights, and scaled classes for all breakpoints
Requires
- [mixin]
_set-sizes - [mixin]
_breakpoint - [function]
_bp-name - [function]
_bp-scale-values - [variable]
breakpoints
font-size
@mixin font-size($font-sizes, $line-height: true) { ... }Description
Sets font-size and line-height for each font-size in $font-sizes list
Setting line-height parameter to false will throw off the vertical rhythm of the page but can be useful for some elements
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$font-sizes | List of | List | —none |
$line-height | Whether or not to set the | Bool | true |
Output
font-size and line-height for each value in $font-sizes
Example
Usage
section {
@include font-size(16px);
}
//-> section {
//-> font-size: 1rem;
//-> line-height: 1.5rem;
//-> }
//-> @media screen and (min-width: 30rem) {
//-> section {
//-> font-size: 1.125rem;
//-< line-height: 1.6875rem;
//-> }
//-> }
//-> … for each breakpointThrows
You have used #{length($font-sizes)} font-sizes. You have defined #{length($breakpoints)} breakpoints. You can only use 1 font-size or the same number of font-sizes as there are breakpoints (#{length($breakpoints)}).
Requires
- [mixin]
_breakpoint - [function]
_to-rem - [function]
_line-height - [function]
_bp-name
line-height
@mixin line-height($font-sizes, $scale: 1) { ... }Description
Sets line-height separate from font-size. If you need to scale the line-height up, use this mixin.
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$font-sizes | List of | List | —none |
$scale | Value by which to scale the | Number | 1 |
Output
line-height for each value in $font-sizes
Requires
- [mixin]
_height
max-height
@mixin max-height($font-sizes, $scale) { ... }Description
Sets max-height for an element
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$font-sizes | List of | List | —none |
$scale | Value by which to scale the max-height | Number | —none |
Output
max-height for each value in $font-sizes
Requires
- [mixin]
_height
padding
@mixin padding($scale: 1 0, $decimal: false) { ... }Description
Sets padding as a multiple of the modular scale
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$scale | Scale value for | List | 1 0 |
$decimal | Allow or don't allow decimal values. Decimal values will throw off vertical scale so | Bool | false |
Output
padding values for all breakpoints
Requires
- [mixin]
_padding-margin
Used by
- [mixin]
_padding-margin
padding-top
@mixin padding-top($scale: 1, $decimal: false) { ... }Description
Sets padding-top as a multiple of the modular scale
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$scale | Scale value for | Number | 1 |
$decimal | Allow or don't allow decimal values. Decimal values will throw off vertical scale so | Bool | false |
Output
padding-top value for all breakpoints
Requires
- [mixin]
_padding-margin-individual
padding-right
@mixin padding-right($scale: 1, $decimal: false) { ... }Description
Sets padding-right as a multiple of the modular scale
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$scale | Scale value for | Number | 1 |
$decimal | Allow or don't allow decimal values. Decimal values will throw off vertical scale so | Bool | false |
Output
padding-right value for all breakpoints
Requires
- [mixin]
_padding-margin-individual
padding-bottom
@mixin padding-bottom($scale: 1, $decimal: false) { ... }Description
Sets padding-bottom as a multiple of the modular scale
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$scale | Scale value for | Number | 1 |
$decimal | Allow or don't allow decimal values. Decimal values will throw off vertical scale so | Bool | false |
Output
padding-bottom value for all breakpoints
Requires
- [mixin]
_padding-margin-individual
padding-left
@mixin padding-left($scale: 1, $decimal: false) { ... }Description
Sets padding-left as a multiple of the modular scale
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$scale | Scale value for | Number | 1 |
$decimal | Allow or don't allow decimal values. Decimal values will throw off vertical scale so | Bool | false |
Output
padding-left value for all breakpoints
Requires
- [mixin]
_padding-margin-individual
margin
@mixin margin($scale: 1 0, $decimal: false) { ... }Description
Sets margin as a multiple of the modular scale
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$scale | Scale value for | List | 1 0 |
$decimal | Allow or don't allow decimal values. Decimal values will throw off vertical scale so | Bool | false |
Output
margin values for all breakpoints
Requires
- [mixin]
_padding-margin
Used by
- [mixin]
_padding-margin
margin-top
@mixin margin-top($scale: 1, $decimal: false) { ... }Description
Sets margin-top as a multiple of the modular scale
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$scale | Scale value for | Number | 1 |
$decimal | Allow or don't allow decimal values. Decimal values will throw off vertical scale so | Bool | false |
Output
margin-top value for all breakpoints
Requires
- [mixin]
_padding-margin-individual
margin-right
@mixin margin-right($scale: 1, $decimal: false) { ... }Description
Sets margin-right as a multiple of the modular scale
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$scale | Scale value for | Number | 1 |
$decimal | Allow or don't allow decimal values. Decimal values will throw off vertical scale so | Bool | false |
Output
margin-right value for all breakpoints
Requires
- [mixin]
_padding-margin-individual
margin-bottom
@mixin margin-bottom($scale: 1, $decimal: false) { ... }Description
Sets margin-bottom as a multiple of the modular scale
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$scale | Scale value for | Number | 1 |
$decimal | Allow or don't allow decimal values. Decimal values will throw off vertical scale so | Bool | false |
Output
margin-bottom value for all breakpoints
Requires
- [mixin]
_padding-margin-individual
margin-left
@mixin margin-left($scale: 1, $decimal: false) { ... }Description
Sets margin-left as a multiple of the modular scale
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$scale | Scale value for | Number | 1 |
$decimal | Allow or don't allow decimal values. Decimal values will throw off vertical scale so | Bool | false |
Output
margin-left value for all breakpoints
Requires
- [mixin]
_padding-margin-individual
dropcap
@mixin dropcap($float-position: left, $font-size: 4em, $font-family: inherit, $txt-indent: 0, $margin: 10px 10px 0 0, $padding: 0 20px, $color: inherit, $line-height: 1, $bg: transparent) { ... }Description
Make first letter a dropcap
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$float-position | Float dropcap so that it does not interupt vertical rhythm of paragraph | String | left |
$font-size |
| Number | 4em |
$font-family |
| String | inherit |
$txt-indent | Text indent for dropcap | Number | 0 |
$margin |
| List | 10px 10px 0 0 |
$padding |
| List | 0 20px |
$color |
| Color | inherit |
$line-height |
| Number | 1 |
$bg |
| List | transparent |
Output
Properties to create a dropcap
Private Helpers—General
functions
[private] _to-rem
@function _to-rem($value) { ... }Description
Convert value to rems
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$value | Value to convert to | Number | —none |
Returns
Number —Value converted into rems
Example
unitless to rem
_to-rem(1)
// -> 1rempx to rem
_to-rem(16px)
// -> 1rem% to rem
_to-rem(100%)
// -> 1remThrows
#{$value} is an invalid value for function
to-rem. Userem,px,%, or an unitless number instead.
Requires
- [function]
_px-to-rem - [function]
_percent-to-rem
Used by
- [function]
_to-unitless - [mixin]
_set-sizes - [mixin]
_breakpoint - [function]
_bp-size - [mixin]
font-size
Author
Jared Howland
[private] _to-px
@function _to-px($value) { ... }Description
Convert value to pxs
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$value | Value to convert to | Number | —none |
Returns
Number —Value converted into pxs
Example
unitless to px
_to-px(1)
// -> 16pxrem to px
_to-px(1rem)
// -> 16px% to px
_to-px(100%)
// -> 16pxThrows
#{$value} is an invalid value for function
to-px. Userem,px,%, or an unitless number instead.
Requires
- [function]
_rem-to-px - [function]
_percent-to-px
Used by
- [function]
_line-height - [function]
_max-line-width - [mixin]
_set-sizes - [function]
_bp-base-font-size - [function]
_create-scale
Author
Jared Howland
[private] _to-percent
@function _to-percent($value) { ... }Description
Convert value to %s
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$value | Value to convert to | Number | —none |
Returns
Number —Value converted into %s
Example
unitless to %
_to-percent(1)
// -> 100%rem to %
_to-percent(1rem)
// -> 100%px to %
_to-percent(16px)
// -> 100%Throws
#{$value} is an invalid value for function
to-percent. Userem,px,%, or an unitless number instead.
Requires
- [function]
_percent-to-px - [function]
_rem-to-percent
Author
Jared Howland
[private] _to-unitless
@function _to-unitless($value) { ... }Description
Convert value to be unitless
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$value | Value to convert to be unitless. Acceptable units are | Number | —none |
Returns
Number —Value converted into unitless
Example
% to unitless
_to-unitless(100%)
// -> 1rem to unitless
_to-unitless(1rem)
// -> 1px to unitless
_to-unitless(16px)
// -> 1Requires
- [function]
_strip-units - [function]
_to-rem
Used by
- [function]
_bp-line-height - [function]
_modular-scale-value
Author
Jared Howland
[private] _px-to-rem
@function _px-to-rem($value) { ... }Description
Convert px to rem
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$value | Value to be converted to | Number | —none |
Returns
Number —Value converted into rem
Example
px to rem
_px-to-rem(16px)
// -> 1remRequires
- [function]
_strip-units - [variable]
default-browser-font-size
Used by
- [function]
_to-rem
Author
Jared Howland
[private] _percent-to-rem
@function _percent-to-rem($value) { ... }Description
Convert % to rem
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$value | Value to be converted to | Number | —none |
Returns
Number —Value converted into rem
Example
% to rem
_percent-to-rem(100%)
// -> 1remRequires
- [function]
_strip-units
Used by
- [function]
_to-rem
Author
Jared Howland
[private] _rem-to-px
@function _rem-to-px($value) { ... }Description
Convert rem to px
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$value | Value to be converted to | Number | —none |
Returns
Number —Value converted into px
Example
rem to px
_rem-to-px(1rem)
// -> 16pxRequires
- [function]
_strip-units - [variable]
default-browser-font-size
Used by
- [function]
_to-px
Author
Jared Howland
[private] _percent-to-px
@function _percent-to-px($value) { ... }Description
Convert % to px
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$value | Value to be converted to | Number | —none |
Returns
Number —Value converted into px
Example
% to px
_percent-to-px(100%)
// -> 16pxRequires
- [function]
_strip-units - [variable]
default-browser-font-size
Used by
- [function]
_to-px - [function]
_to-percent
Author
Jared Howland
[private] _rem-to-percent
@function _rem-to-percent($value) { ... }Description
Convert rem to %
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$value | Value to be converted to | Number | —none |
Returns
Number —Value converted into %
Example
rem to %
_rem-to-percent(1rem)
// -> 100%Requires
- [function]
_strip-units
Used by
- [function]
_to-percent
Author
Jared Howland
[private] _px-to-percent
@function _px-to-percent($value) { ... }Description
Convert px to %
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$value | Value to be converted to | Number | —none |
Returns
Number —Value converted into %
Example
px to %
_px-to-percent(16px)
// -> 100%Requires
- [function]
_strip-units - [variable]
default-browser-font-size
Author
Jared Howland
[private] _strip-units
@function _strip-units($value) { ... }Description
Strip units from a number
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$value | Value to strip unit from | Number | —none |
Returns
Number —Value without units
Example
Strip rem
_strip-units(1rem)
// -> 1Strip px
_strip-units(16px)
// -> 16Used by
- [function]
_to-unitless - [function]
_px-to-rem - [function]
_percent-to-rem - [function]
_rem-to-px - [function]
_percent-to-px - [function]
_rem-to-percent - [function]
_px-to-percent - [function]
_line-height - [function]
_max-line-width - [function]
_bp-base-line-height-ratio
Author
Jared Howland
[private] _line-height
@function _line-height($font-size, $i: 1) { ... }Description
Line height for a given font-size and breakpoint
Mixins will pass a number to this function to represent a breakpoint
1 through the number of breakpoints
Number depends on the number of breakpoints defined in your $breakpoints map
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$font-size | Font size of the line ( | Number | —none |
$i | Breakpoint number (1 through the number of breakpoints) | Number | 1 |
Returns
Number —The line height in rems
Throws
There is no breakpoint #{$i}. Enter a valid number (1-#{length($breakpoints)}).
Requires
- [function]
_to-px - [function]
_bp-base-font-size - [function]
_bp-base-line-height-ratio - [function]
_strip-units - [variable]
breakpoints - [variable]
default-browser-font-size
Used by
- [mixin]
_set-sizes - [mixin]
_height - [mixin]
_padding-margin - [mixin]
_padding-margin-individual - [mixin]
font-size
Author
Jared Howland
[private] _max-line-width
@function _max-line-width($font-size, $line-height) { ... }Description
Optimal line width
Line widths that are too short or too long make it difficult to read.
Calculate the optimal line width for a given font-size and line-height: (line-height (in px))^2
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$font-size | Font size of the line ( | Number | —none |
$line-height | Line height of the line ( | Number | —none |
Returns
Number —The optimal line width in px
Requires
- [function]
_strip-units - [function]
_to-px
Used by
- [mixin]
_set-sizes
Links
Author
Jared Howland
[private] _pow
@function _pow($base, $exponent) { ... }Description
Raises a number to the nth power
Used when generating heading sizes from a modular scale
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$base | Base number | Number | —none |
$exponent | Power to raise base number to | Number | —none |
Returns
Number —Result of a base number raised to given power
Example
2^4
_pow(2, 4)
// -> 16Used by
- [function]
_create-scale-values
Author
Jared Howland
mixins
[private] _set-sizes
@mixin _set-sizes($i) { ... }Description
Calculates and sets sizes for elements, classes, and variables for breakpoint $i
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$i | Breakpoint for which to set sizes | Number | —none |
Output
font-size and line-height for all breakpoints
Example
Usage
body {
@include rhythm();
}
// -> body {
// -> font-size: 1rem;
// -> line-height: 1.5rem;
// -> }
// -> .tera {
// -> font-size: 4.25rem;
// -> line-height: 4.5rem
// -> }
// ->
// -> .giga {
// -> font-size: 2.9375rem;
// -> line-height: 3rem
// -> }
// ->
// -> .mega {
// -> font-size: 2.625rem;
// -> line-height: 3rem
// -> }
// ->
// -> h1, .h1, .alpha {
// -> font-size: 1.8125rem;
// -> line-height: 3rem
// -> }
// ->
// -> h2, .h2, .beta {
// -> font-size: 1.625rem;
// -> line-height: 3rem
// -> }
// ->
// -> h3, .h3, .gamma {
// -> font-size: 1.125rem;
// -> line-height: 1.5rem
// -> }
// ->
// -> h4, .h4, .delta {
// -> font-size: 1rem;
// -> line-height: 1.5rem
// -> }
// ->
// -> h5, .h5, .epsilon, small, .caption {
// -> font-size: 0.6875rem;
// -> line-height: 1.5rem
// -> }
// ->
// -> h6, .h6, .zeta {
// -> font-size: 0.625rem;
// -> line-height: 1.5rem
// -> }
// ->
// -> section, .section {
// -> margin: 0 auto;
// -> max-width: 36rem
// -> }
// -> … for each breakpoint (`rhythm` mixin uses `_set_sizes` and loops through the breakpoints)Requires
- [function]
_bp-base-font-size - [function]
_bp-base-line-height - [function]
_bp-base-line-height-ratio - [function]
_bp-scale-values - [function]
_to-rem - [function]
_to-px - [function]
_line-height - [function]
_max-line-width
Used by
- [mixin]
rhythm
[private] _breakpoint
@mixin _breakpoint($breakpoint-name: all) { ... }Description
Allows you to set a value for a particular breakpoint Can accept a breakpoint name as defined in $breakpoints map or it can accept a custom value outside of the defined breakpoints or it can accept string all to define something for all breakpoints
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$breakpoint-name | Value or name of breakpoint. | Number or String | all |
Content
This mixin allows extra content to be passed (through the @content directive).
Output
Media query for specified breakpoint
Example
Usage
@include _breakpoint(2) {
body {
color: #F5F5F5;
}
}
//-> @media screen and (min-width: 30rem) {
//-> body {
//-> color: #F5F5F5;
//-> }
//-> }Requires
- [function]
_to-rem - [variable]
breakpoints
Used by
- [mixin]
_height - [mixin]
_padding-margin - [mixin]
_padding-margin-individual - [mixin]
rhythm - [mixin]
font-size
Links
[private] _height
@mixin _height($value, $font-sizes, $scale: 1) { ... }Description
Sets various heights for given font-sizes as multiples of the modular scale
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$value | What height to set (accepts any string but | String | —none |
$font-sizes | List of | List | —none |
$scale | Value by which to scale the | Number | 1 |
Throws
You have used #{length($font-sizes)}
font-sizes. You have defined #{length($breakpoints)} breakpoints. You can only use 1font-sizeor the same number offont-sizes as there are breakpoints.
Requires
- [mixin]
_breakpoint - [function]
_line-height - [function]
_bp-name - [variable]
breakpoints
Used by
- [mixin]
line-height - [mixin]
max-height
[private] _padding-margin
@mixin _padding-margin($value, $scale: 1 0, $decimal: false) { ... }Description
Set padding and margin using CSS shorthand method as multiples of the modular scale
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$value | Setting you wish to use: | String | —none |
$scale | List of values by which to scale the | List | 1 0 |
$decimal | Whether or not to allow decimal values. Whole integers maintain the vertical rhythm while portions of whole integers can throw off the rhythm unless the top and bottom | Bool | false |
Output
Sets the padding or margin based on the scale values passed to mixin
Throws
Invalid number of #{$value} values. Use 1, 2, 3, or 4 values only.
Requires
- [mixin]
padding - [mixin]
_breakpoint - [mixin]
margin - [function]
_line-height - [function]
_bp-base-font-size - [function]
_bp-name - [variable]
breakpoints
Used by
[private] _padding-margin-individual
@mixin _padding-margin-individual($value, $scale: 1, $decimal: false) { ... }Description
Set padding or margin individually (padding-right, margin-bottom, etc) as multiples of modular scale
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$value | Setting you wish to use: | String | —none |
$scale | List of values by which to scale the | List | 1 |
$decimal | Whether or not to allow decimal values. Whole integers maintain the vertical rhythm while portions of whole integers can throw off the rhythm unless the top and bottom | Bool | false |
Output
Sets the padding or margin based on the scale values passed to mixin
Throws
#{$value} mixin can only accept a single value.
Requires
- [mixin]
_breakpoint - [function]
_line-height - [function]
_bp-base-font-size - [function]
_bp-name - [variable]
breakpoints
Used by
- [mixin]
padding-top - [mixin]
padding-right - [mixin]
padding-bottom - [mixin]
padding-left - [mixin]
margin-top - [mixin]
margin-right - [mixin]
margin-bottom - [mixin]
margin-left
Private Helpers—Breakpoints
functions
[private] _get-bp-names
@function _get-bp-names() { ... }Description
Get all breakpoint names from $breakpoints map
Parameters
None.
Returns
List —List of all names for breakpoints
Requires
- [variable]
breakpoints
Used by
- [function]
_bp-name
Author
Jared Howland
[private] _bp-name
@function _bp-name($i) { ... }Description
Get breakpoint name for breakpoint $i
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$i | Breakpoint number. Must be between 1 and the number of breakpoints defined in | Number | —none |
Returns
String —Name of specified breakpoint
Requires
- [function]
_get-bp-names
Used by
- [mixin]
_height - [mixin]
_padding-margin - [mixin]
_padding-margin-individual - [mixin]
rhythm - [mixin]
font-size
Author
Jared Howland
[private] _get-bp-data
@function _get-bp-data($i) { ... }Description
Get all data about breakpoint $i
Breakpoint location, font-size, line-height, and name of modular scale
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$i | Breakpoint number. Must be between 1 and the number of breakpoints defined in | Number | —none |
Returns
Map —Map of data for specified breakpoint
Requires
- [variable]
breakpoints
Used by
- [function]
_bp-size - [function]
_bp-font-sizes - [function]
_bp-line-height - [function]
_bp-scale-name
Author
Jared Howland
[private] _bp-size
@function _bp-size($i) { ... }Description
Breakpoint location returned in rem for breakpoint $i
Not actively used yet.
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$i | Breakpoint number. Must be between 1 and the number of breakpoints defined in | Number | —none |
Returns
Number —Breakpoint location expressed as rem
Requires
- [function]
_to-rem - [function]
_get-bp-data
Author
Jared Howland
[private] _bp-font-sizes
@function _bp-font-sizes($i) { ... }Description
Stranded font-sizes for breakpoint $i
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$i | Breakpoint number. Must be between 1 and the number of breakpoints defined in | Number | —none |
Returns
List —List of font-size strands for breakpoint $i
Requires
- [function]
_get-bp-data
Used by
- [function]
_bp-scale-values - [function]
_bp-base-font-size
Author
Jared Howland
[private] _bp-line-height
@function _bp-line-height($i) { ... }Description
Line height for the breakpoint in unitless value
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$i | Breakpoint number. Must be between 1 and the number of breakpoints defined in | Number | —none |
Returns
Number —Unitless line-height value for breakpoint $i. If it doesn't exist, use the modular scale value as the line-height.
Requires
- [function]
_get-bp-data - [function]
_to-unitless - [function]
_modular-scale-value - [function]
_bp-scale-name
Used by
- [function]
_bp-base-line-height
Author
Jared Howland
[private] _bp-scale-name
@function _bp-scale-name($i) { ... }Description
Name of modular scale for breakpoint $i
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$i | Breakpoint number. Must be between 1 and the number of breakpoints defined in | Number | —none |
Returns
String —Name of modular scale
Requires
- [function]
_get-bp-data
Used by
- [function]
_bp-line-height - [function]
_bp-scale - [function]
_bp-scale-values
Author
Jared Howland
[private] _bp-scale
@function _bp-scale($i) { ... }Description
Ratio value for creating modular scales of breakpoint $i
Not actively used yet.
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$i | Breakpoint number. Must be between 1 and the number of breakpoints defined in | Number | —none |
Returns
Number —Unitless ratio value of named modular scale
Requires
- [function]
_modular-scale-value - [function]
_bp-scale-name
Author
Jared Howland
[private] _bp-scale-values
@function _bp-scale-values($i) { ... }Description
9 values derived from the modular scale and base font-size for breakpoint $i; 2 smaller than base font-size; 7 larger than or equal to base font-size
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$i | Breakpoint number. Must be between 1 and the number of breakpoints defined in | Number | —none |
Returns
List —List of values based on modular scale of breakpoint $i
Requires
- [function]
_create-scale - [function]
_bp-font-sizes - [function]
_bp-scale-name
Used by
- [mixin]
_set-sizes - [mixin]
rhythm
Author
Jared Howland
[private] _bp-base-font-size
@function _bp-base-font-size($i) { ... }Description
Gets the first value in the font-size list for breakpoint $i
Assumes first value in list is the base font-size
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$i | Breakpoint number. Must be between 1 and the number of breakpoints defined in | Number | —none |
Returns
Number —Base font-size in px
Requires
- [function]
_to-px - [function]
_bp-font-sizes
Used by
- [function]
_line-height - [mixin]
_set-sizes - [mixin]
_padding-margin - [mixin]
_padding-margin-individual - [function]
_bp-base-line-height - [function]
_bp-base-line-height-ratio
Author
Jared Howland
[private] _bp-base-line-height
@function _bp-base-line-height($i) { ... }Description
Base line-height for breakpoint $i in px
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$i | Breakpoint number. Must be between 1 and the number of breakpoints defined in | Number | —none |
Returns
Number —Base line-height for breakpoint $i rounded to nearest px
Requires
- [function]
_bp-line-height - [function]
_bp-base-font-size
Used by
- [mixin]
_set-sizes - [function]
_bp-base-line-height-ratio
Author
Jared Howland
[private] _bp-base-line-height-ratio
@function _bp-base-line-height-ratio($i) { ... }Description
Base line-height expressed as a unitless ratio for breakpoint $i
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$i | Breakpoint number. Must be between 1 and the number of breakpoints defined in | Number | —none |
Returns
Number —Unitless ratio of line-height for breakpoint $i
Requires
- [function]
_strip-units - [function]
_bp-base-line-height - [function]
_bp-base-font-size
Used by
- [function]
_line-height - [mixin]
_set-sizes - [function]
_bp-base-scale-ratio
Author
Jared Howland
[private] _bp-base-scale-ratio
@function _bp-base-scale-ratio($i) { ... }Description
Base modular scale for breakpoint $i
Not actively used yet
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$i | Breakpoint number. Must be between 1 and the number of breakpoints defined in | Number | —none |
Returns
Number —Untiless ratio for modular scale
Requires
- [function]
_bp-base-line-height-ratio
Author
Jared Howland
Private Helpers—Modular Scale
functions
[private] _modular-scale-value
@function _modular-scale-value($scale-name: golden) { ... }Description
Finds the numerical value of a named modular scale: golden, minor-second, etc.
Will return an unitless {Number} if a {Number} is passed instead of a {String}.
If $scale-name does not exist, will return 1.618 (golden ratio).
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$scale-name | Name of the modular scale | String | golden |
Returns
Number —Unitless modular scale value
Requires
- [function]
_to-unitless - [variable]
modular-scales
Used by
- [function]
_bp-line-height - [function]
_bp-scale - [function]
_create-scale
Author
Jared Howland
[private] _create-scale
@function _create-scale($font-sizes, $modular-scale: golden) { ... }Description
Creates modular scales for each font-size strand
Supports double-stranded modular scales
Technically, _create-scale() supports as many strands as you pass to it but 2 is the recommended maximum.
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$font-sizes | List of each | List | —none |
$modular-scale | Name of modular scale you want to use as basis for scale | String | golden |
Returns
List —List of 9 values based on $font-sizes and $modular-scale
Requires
- [function]
_modular-scale-value - [function]
_to-px - [function]
_create-scale-values
Used by
- [function]
_bp-scale-values
TODO's
Use an
arglistforfont-sizes rather than a list: http://www.sitepoint.com/sass-multiple-arguments-lists-or-arglist/
Links
Author
Jared Howland
[private] _create-scale-values
@function _create-scale-values($font-size, $modular-scale) { ... }Description
Creates 9 values based on a single font-size for chosen scale value
Parameters
| parameterName | parameterDescription | parameterType | parameterDefault value |
|---|---|---|---|
$font-size | Font size in | Number | —none |
$modular-scale | Modular scale as unitless value | Number | —none |
Returns
List —List of 9 values based on the modular scale; 2 smaller than $font-size; 7 larger than or equal to $font-size
Requires
- [function]
_pow
Used by
- [function]
_create-scale
Author
Jared Howland