DEV Community

Discussion on: The case for * { margin: 20px }

Collapse
 
gajus profile image
Gajus Kuizinas

Use negative margin as is illustrated in one of the examples.

Collapse
 
aleksandrhovhannisyan profile image
Aleksandr Hovhannisyan

Why introduce unnecessary complexity, though? You could just as well do 0 20px 20px 0 and have unidirectional flow, or margin-bottom: 20px, or only margin-top: 20px. You're creating problems for yourself that could be avoided altogether.

Thread Thread
 
gajus profile image
Gajus Kuizinas

Because it is not a real world scenario. The whole point of this pattern is to enforce a consistent spacing between members of a container. If one element requires different spacing than others, then your hierarchy of elements is off. I will update article to make this more clear.