padding margin content code example

Example 1: how to make a box in html

<div style="width:500px;height:100px;border:1px solid #000;">This is a rectangle!</div>

Example 2: css padding vs margin

/* Answer to: "css padding vs margin" */

/*
  Margin is outer space of an element, while padding is inner space
  of an element. Margin is the space outside the border of an
  element, while padding is the space inside the border of it.
  Margin accepts the value of auto: margin: auto , but you can't
  set padding to auto.

  For more information, head over to:
  https://stackoverflow.com/questions/2189452/when-to-use-margin-vs-padding-in-css
*/

Example 3: css box model

MDN (Mozilla Developer Network)
Probably the best place for an in-depth explanation of
web related technologies.

See the link below regarding the CSS BOX MODEL

Tags: