0

What is the use of padding?

6th Oct 2018, 8:07 PM
Prajwal
Prajwal - avatar
4 Answers
+ 4
It provides breathing room between an element's content and the element's border (if any). To provide some context, margins provide breathing room between the element's border (if any) and other elements, but margins tend to collapse / overlap by design. To see this in action, poke around any website from a desktop or laptop and right click to inspect the elements. A box model should pop up to show you what the margin, border, and padding values are on each side of the element.
6th Oct 2018, 8:28 PM
Janning⭐
Janning⭐ - avatar
+ 1
create a div with fixed sizes for example width: 300px and height: 300px. Fill it with any color. Create another div inside first with 150px sides and fill with another color, write there some text. Play with margin and padding of second box and you’ll get the idea :)
6th Oct 2018, 9:04 PM
Sokrat_Poghosyan
Sokrat_Poghosyan - avatar
+ 1
okay. i understood, thank you guys👍✌
6th Oct 2018, 9:07 PM
Prajwal
Prajwal - avatar
+ 1
You’re welcome!
6th Oct 2018, 9:09 PM
Sokrat_Poghosyan
Sokrat_Poghosyan - avatar