DEV Community

Discussion on: A Modern CSS Reset

Collapse
 
cullylarson profile image
Cully Larson

What do you think about adding something like this:

p:first-child, h1:first-child, h2:first-child, ... {
  margin-top: 0;
}

p:last-child, h1:last-child, h2:last-child, ... {
  margin-bottom: 0;
}
Enter fullscreen mode Exit fullscreen mode

or even:

*:first-child {
  margin-top: 0;
}

*:last-child {
  margin-bottom: 0;
}
Enter fullscreen mode Exit fullscreen mode

I seem to always be removing margin top on the first item and margin bottom on the last item, since it pushes a container out too far or something.