what is the padding's role on the css and html -


this question has answer here:

i use sytle padding script

like this

<style> #img1{padding:7px 10px} </style> <body> <img src="myjpg.jpg" id="img1"/> </body> 

i can't understand exactely role of padding.

maybe padding's function object's out layer margin??

as can see in image (shared josh) :

padding

say have element c parent p.

  • padding : when applied p, adds space inside p, outside c.
  • padding : when applied c, adds space inside c.
  • margin : when applied c, adds space outside c, inside p.
  • margin : when applied p, adds space outside p, inside p's parent.

you may notice 1st & 3rd case alike when p & c considered.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -