Skip to content

Instantly share code, notes, and snippets.

@shelane
Created July 18, 2024 11:40
Show Gist options
  • Save shelane/3e4edcab3a4224266f54d56bae3bb011 to your computer and use it in GitHub Desktop.
Save shelane/3e4edcab3a4224266f54d56bae3bb011 to your computer and use it in GitHub Desktop.
Best CSS trick: instead of position relative + position absolute; use grid to overlay children
.parent { display: grid; }
.child { grid-area: 1/1; }
Instead of:
.parent { position: relative }
.child { position: absolute; top: 0; left: 0; width: 100%; height: 100% }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment