Created
August 31, 2021 17:29
-
-
Save dougkeeling/59edb52ca7ee668539c64f39c034a443 to your computer and use it in GitHub Desktop.
[Cover one <div> with another completely] Allows for a specific amount of padding/inset from the edge of the parent div. #scss #css
This file contains hidden or 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 cover($pos:absolute,$inset:0px) { | |
position: $pos; | |
bottom: $inset; | |
left: $inset; | |
right: $inset; | |
top: $inset; | |
width: calc(100% - (#{$inset} * 2)); | |
height: calc(100% - (#{$inset} * 2)); | |
} | |
.parent-div { | |
.child-div { | |
@include cover(fixed,10px); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment