Can margin be set to a negative value?
margin can be negative.
Behavior features:
- the element can "shift" and overlap neighboring blocks;
- a negative
margin-topandmargin-leftpull the element closer to the preceding content; - a negative
margin-bottomandmargin-rightcan pull neighboring elements inward;
This is valid per the specification and is often used, but requires care so as not to break the structure.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.