Tell us what’s happening:
Why when I set the value to margin minus something of the injected text green box and then the yellow box div soak up the the injected text green box and the background turns yellow
The same thing happen if I use a ID for set the background color and me sure that the background will be the same (because it¡s more important) but idk why the same thing is happen even with the ID
Yeah, that’s a little odd. I understand it as when you have the negative margin, it puts it behind the green background gets covered by the yellow background. The foreground (the text) shows through because that top layer has no foreground. It’s a bit odd, but it kinda makes sense.
I’m not completly sure that I get what you said, but I didn’t mark the previous answer as a solution because I want to see if someone else could give me anothers answers because I’m still having the same doubt , may be someone else could explain me better , that’s why I didn’t mark it as a solution
Thanks for your suggestion @rajat310 !
Margins are a way to define how much distance you want between two elements (in this case, the .injected-text and the .yellow-box below it). With a positive margin, you increase the distance, and with a negative margin, you decrease it. Meaning that the following element (the .yellow-box) will be dragged upwards.