Skip to content

Instantly share code, notes, and snippets.

@413n
Last active December 14, 2021 17:23
Show Gist options
  • Save 413n/37523b7e9e089761138e6abb8a8faf9f to your computer and use it in GitHub Desktop.
Save 413n/37523b7e9e089761138e6abb8a8faf9f to your computer and use it in GitHub Desktop.
CSS Useful Tricks

CSS Useful Tricks

Bottom Padding in Scrollable overflowing content

My workaround for fixing this bug in my project was (helpful when you want the children centered with margin: auto in a flex container if there is no scroll.):

.overflowing-container > *:last-child:after {
     display: block;
     height: 1rem; /* Match bottom padding */
     margin-bottom: -1rem; /* Move it outside */
     content: "";
 }

Credits: w3c/csswg-drafts#129 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment