Css margin-top vs margin-bottom
I always use margin-bottom
, which means there is no unnecessary space before the first element.
Depends on context. But, generally margin-top
is better because you can use :first-child
to remove it. Like so:
div.block {
margin-top: 10px;
}
div.block:first-child {
margin-top: 0;
}
This way, the margins are only in between the blocks.
Only works for more modern browsers, obviously.