CSS Tutorial

Setting Margins on all Sides

<!DOCTYPE html>
<title>Example</title>
<style>
  div {
    border: 1px solid orange;
  }
  div > p {
    background: gold;
    margin: 20px;
  }
</style>
<div>
  <p>
    This text has a margin of 20 pixels on all four sides. It is nested within a div with a border to make it easier to see the effect of the margin.
  </p>
</div>