<?xml version="1.0" encoding="utf-8"?>

CSS margin's negative values

CSS margin's negative values Bad Practice
CSS margin's negative values Best Practice

Unlike padding, margin can have a negative value. A top/left negative value pulls the element in the specified direction, while a bottom/right clashes a succeeding element with the main one.

In general, negative values don't influence the page's flow even if you apply them to static elements. In other words, if you use a negative margin to nudge an element upwards, all succeeding elements will be pulled as well.

Improve your UX & Product skills with interactive courses that actually work