TIL gap in CSS
POSTED ON:
TAGS: css codepen responsive webdev
Say you want elements to be 1rem
distant apart, except for the last element.
This is the lame-o classic hacky way to do it.
div > *:not(:last-child) {
margin-bottom: 1rem;
}
With Flex and Grid, you can use gap
.
div {
gap: 1rem;
}
It's so nice.
See the Pen margin-bottom vs gap by rockykev (@rockykev) on CodePen.
VIA
https://mobile.twitter.com/brad_frost/status/1359953369369088003
Related TILs
Tagged: css