1.4 HTML Rules


The 4 Rules

To comply with the W3C standards, you must follow these 4 rules:

  1. Nest all elements properly
    <p><strong>This is proper nesting</strong></p>
    <p><strong>This is improper nesting</p></strong>
  3. All values must be in quotes
    <element attribute="value">This is proper nesting</element>

  5. Use lowercase for elements and attributes (and generally values too)
  6. Every element must be ended properly. Most elements have a "regular" ending where you end the element with a slash in a separate ending tag.
    <p>  </p>
    <h1>  </h1>
    <a>  </a>
    <body>  </body>

Error Checking

If you make a mistake in your HTML, you will not be alerted in any way by the text editor, browser, or anything else. In some cases the page, element, or content may still show up just fine, In other cases, it may not. If something is not working or displaying properly check:

  1. The starting element
  2. The ending element
  3. Your quotes
  4. The element before the affected one

There are 3rd party tools we can use to check for errors, but we’ll come back to this. Remember: it’s important to follow the rules and standards.


Comment tags are used to insert notes in the HTML source code. HTML comments are visible to anyone that views the page source code, but are not shown when the HTML document is rendered by a browser.

<!-- the text typed in between these delimeters will not show up -->

Use comments to put your name and/or date at the top of your files and leave notes to yourself and others within the HTML files.

Finding Help Online

How do I know what valid attributes are for elements? How do I do _______________ in HTML? Find yourself a good reference book or head over to Google. Just start your search with either HTML or CSS to help narrow the results down. Two sites that you will see often are and

Using code you find online is encouraged! Just be sure you: 1) understand what it does and 2) format it correctly and follow our rules.