Four parts of a box

The content is surrounded by padding; the border goes around both. Margin is the outer space that separates the element from its neighbors. The border-box sizing rule makes a declared width include padding and border.

* {
  box-sizing: border-box;
}

.card {
  width: 300px;
  padding: 1rem;
  border: 1px solid gray;
}

Learn more