Skip to content

Instantly share code, notes, and snippets.

@mborsare
Created April 4, 2018 18:17
Show Gist options
  • Save mborsare/cc7446c22a1f45a6d31580a434fbc274 to your computer and use it in GitHub Desktop.
Save mborsare/cc7446c22a1f45a6d31580a434fbc274 to your computer and use it in GitHub Desktop.
A nice little z-index Sass map thing
This may be a little heavy-handed for this project, but here's a map I often use for z-indexes (mostly to keep things agnostic and in context). Values Eric Bailey originally concocted actually!
$z-index: (
basement: -999999,
layout: 1000,
object: 2000,
component: 3000,
subcomponent: 3010,
modal: 4000,
submodal: 4010,
ceiling: 999999,
);
And then use this function:
@function get-z-index($index) {
@return map-get($z-index, $index);
}
In use:
.foo-modal {
z-index: get-z-index("modal");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment