Last active
March 28, 2019 18:57
-
-
Save niktariy/bdb2dce21e9d84fb1ce4abe5c953d415 to your computer and use it in GitHub Desktop.
CSS Custom properties nesting
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
<div class="box"> | |
Hi! I'm box | |
<div class="box__child">Hi! I'm box child</div> | |
</div> |
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
.box { | |
--padding: 20px; | |
padding: var(--padding); | |
background-color: aliceblue; | |
border: 1px solid; | |
} | |
.box__child { | |
padding: var(--padding); | |
background-color: pink; | |
} | |
.box__child::after { | |
--size: calc(100% - var(--padding)); | |
--padding-box: calc(var(--padding) / 2); | |
content: "Hi! I'm box child after content"; | |
display: block; | |
padding: var(--padding-box); | |
width: var(--size); | |
background-color: tan; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment