Margin or padding
Need more understanding on when do i use margin and when do i use padding. Am a little confused. Especially when its a heading and is not a button.
Thank you
5 Replies
Hello @seema0968 , first of all have in mind that when when designing a certain web-page, every element has its own container, in which there is a default margin, padding applied to it. when styling a heading or text you use padding to add or remove the white-space inside the container of the text or element. then, you use margin on headings or other text elements to remove or add the white-space between the heading and other elements on the web-page.
Thank you
padding
is between the content/children of the element and the edge of the element (it makes it bigger or takes away space inside)
marign
is on the outside of the element and is the distance to other elementsIf you open your dev tools (F12), select an element and go to "Computed" you will get this graph:
You're welcome.