I have three elements:

Now my layout requires that the .b element (by the way, if it is important, they are all html <section> s) overlap a bit on the .a element. So I decided to apply position: relative to it, then push it using top: -50px .
What's happening:

I successfully overlaid the top two elements, but now I have created an unnecessary 50px space between .b and .c . (They should have been glued.)
My first assumption was to use the equivalent margin-bottom: -50px , but that didn't work, for some reason I don't know either.
In the end, I resolved this by a roundabout path by making .b child of .a . This caused an overflow of .a above .c , but then I applied the magic number margin-bottom to it to push .c back.
Of course, I am not happy with this decision, so I ask here.
What would you say is the best way to solve this problem?
By the best way, I mean what I want to avoid, if possible:
- creation of additional non-semantic markup
- applying the same
top: -50px rule top: -50px to all subsequent elements on the page - using any magic number on my CSS.
I just want to learn the best practice when I do this because I assume that this will be a problem that I will face more than once in the future.
source share