Specify page margins

In advlayout.html, insert a clear below the
topnav area, then these paragraphs:

  1. Welcome to Tech Tool, the magazine for people who like gadgets.

  2. Every day, we cover the latest in electronic gadgetry.


Below the paragraphs, insert a footer area:
  1. Every day, we cover the latest in electronic gadgetry.

  2. TIP: is an invisible character. It can be used as a placeholder or spacer in Web pages.
  3. In layout.css, add formatting for the footer area:
  4. #footer {
  5. background: #000099;
  6. margin: 0;
  7. padding: 10px;
  8. }
Save layout.css and advlayout.html.

  1. Reload advlayout.html in the browser.
  2. It should look like this:
In layout.css, add formatting for the tag:

  1. body {
  2. margin: 0;
  3. text-align: center;
  4. }
Save layout.css, then reload advlayout.html in the browser.

It should look like this:

  1. Set content width
  2. In advlayout.html, surround the paragraphs in an area for the page's main content:
  3. Welcome to Tech Tool, the magazine for people who like gadgets.

  4. Every day, we cover the latest in electronic gadgetry.

  • In layout.css, add formatting for the maincontent area:
  • #maincontent {
  • margin: 0;
  • padding: 20px;
  • }
  • In advlayout.html, enclose everything between the tags in the pagewidth area:
  • ...
  • In layout.css, add formatting for the pagewidth area:
  • #pagewidth {
  • text-align: left;
  • width: 700px;
  • border-style: solid;
  • border-color: #000000;
  • border-width: 1px;
  • }
  • In layout.css, give the body area a top and bottom margin of 40 pixels:

    1. body {
    2. margin: 40px 0;
    3. text-align: center;
    4. }
    5. TIP: You can use shorthand when setting measurements for margin, padding, borders and other elements: if you only include two measurements, the browser reads the first one as top/bottom:
    6. margin: 20px 0;
    7. and the second one as left/right:
    8. margin: 20px 0;
    Save format.css and advlayout.html.

    Reload advlayout.html in the browser.

    It should look like this:

    TIP: The text-align:center property in the body formatting centered the pagewidtharea in the browser window.

    The text-align:left property in the pagewidth formatting ensured that everything inside it was left-aligned by default.