The meaning of Paddings | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

The meaning of Paddings

please help me understand the meaning and significance of PADDINGS in CSS(3)

17th Dec 2017, 6:22 PM
Sicelo Mpungose
Sicelo Mpungose - avatar
4 Answers
+ 20
To make it simple... the padding is the space INSIDE a container while the margin is the space OUTSIDE it. As you can see in the demo below, the padding allows the black square to be in a larger container: https://code.sololearn.com/W1Zu5Oj1bcHv/?ref=app Another important and related property is: "box-sizing", read something here: https://www.w3schools.com/cssref/css3_pr_box-sizing.asp Try this: https://code.sololearn.com/Wrqen7nngaET/?ref=app
17th Dec 2017, 6:38 PM
Maz
Maz - avatar
+ 3
The padding is like a inset margin. If you have a padding left of 10 pixels, the content inside that element will be displayed 10 pixels away from the left border.
17th Dec 2017, 6:29 PM
voidneo
+ 3
@Mazda and @noname, thank you. very good examples there. I've tried using it. makes more sense now.
18th Dec 2017, 3:04 AM
Sicelo Mpungose
Sicelo Mpungose - avatar
+ 1
Прикольно но можно и улучшить
17th Dec 2017, 8:07 PM
Матвей Рязанцев
Матвей Рязанцев - avatar