Skip to content

Instantly share code, notes, and snippets.

@dougkeeling
Created August 31, 2021 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dougkeeling/59edb52ca7ee668539c64f39c034a443 to your computer and use it in GitHub Desktop.
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
@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