Skip to content

Instantly share code, notes, and snippets.

@sambaldwin
Created November 22, 2015 12:18
Show Gist options
  • Save sambaldwin/ac6af25c781f2b283c3b to your computer and use it in GitHub Desktop.
Save sambaldwin/ac6af25c781f2b283c3b to your computer and use it in GitHub Desktop.
Sass mixin for visible baseline grid
@mixin baseline-grid(
$line-height: false,
$offset: false,
$element: html,
$colour: rgba(0,0,0,.2)
) {
#{$element} {
&:after {
content: "";
position: absolute;
top: $offset;
height: 100%;
width: 100%;
background-image:
linear-gradient(
180deg,
$colour,
$colour 1px,
transparent 1px,
transparent
);
background-size: $line-height $line-height;
}
}
}
@sambaldwin
Copy link
Author

Usage:

@include baseline-grid(20px, 30px, .grid, #f0f);

or without all the options:

@include baseline-grid(20px);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment