Difference b/w Padding & Margin in CSS

Arvind Dhakar
Apr 2, 2021

--

Difference b/w Padding & Margin in CSS

When I was a beginner. Initially, I always confused b/w padding and margin in CSS. Therefore to help beginners, I have written few points that describe the difference b/w padding and margin. So let's begin:-

  • Padding is the difference b/w content(text) of element and border of the same element;
  • Padding increases then element size also increases but content (text) remains the same.
  • While Margin is difference b/w the two elements.
  • Margin describes shifting w.r.t. other element or browser window.

--

--

Arvind Dhakar
Arvind Dhakar

No responses yet