Last active
September 18, 2019 15:40
-
-
Save francisrupert/40ecbfddf32e6c922f8e2053d2c5c9ef to your computer and use it in GitHub Desktop.
SCSS Mixin: reveal dom depth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin DEPTH($rootBG:true) { | |
html body & { | |
@if $rootBG { | |
background-color: rgba(0,0,0,.08); | |
} | |
} | |
html body & * { background-color: rgba(255,0,0,.08) ; } | |
html body & * * { background-color: rgba(0,255,0,.08) ; } | |
html body & * * * { background-color: rgba(0,0,255,.08) ; } | |
html body & * * * * { background-color: rgba(255,0,255,.08); } | |
html body & * * * * * { background-color: rgba(0,255,255,.08); } | |
html body & * * * * * * { background-color: rgba(255,255,0,.08); } | |
html body & * * * * * * * { background-color: rgba(255,0,0,.08) ; } | |
html body & * * * * * * * * { background-color: rgba(0,255,0,.08) ; } | |
html body & * * * * * * * * * { background-color: rgba(0,0,255,.08) ; } | |
} | |
.foo { | |
// root gets bg | |
@include DEPTH; | |
} | |
.bar { | |
// root does *NOT* get bg | |
@include DEPTH(false); | |
} | |
.DEPTH { | |
// root gets bg | |
@include DEPTH; | |
// root does *NOT* get bg | |
&--NO-ROOT { | |
@include DEPTH(false); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment