+ 2

Can anyone explain in details the difference between "margin" and "padding" in css.....

web design

18th Jun 2017, 12:40 PM
El - Mubarak
El - Mubarak - avatar
2 Answers
+ 5
Padding is the space that's inside the element between the element and the border. Padding goes around all four sides of the content and you can target and change the padding for each side with CSS. Margin is the space between the border and next element. https://stackoverflow.com/questions/5958699/difference-between-margin-and-padding
18th Jun 2017, 12:42 PM
Louis
Louis - avatar
0
let us assume that the our content is in the square box. Now the the distance or space of the content from the border of that box is called padding while margin refers to the distance of the border of box from layout of page(page is of square or rectangle shape.
30th Jun 2017, 2:56 AM
Abhisek sharma
Abhisek sharma - avatar