Writing Code

Writing valid, well-formed, syntactically correct code

Headings

Think of headings as the outline to your document. <h1> is the primary headline with each heading level falling beneath that. Use headings to delineate sections of your document, not just to make larger text.

Assistive technology uses headings for navigation within a page and to quickly skip to topic headings on a page.

Lists

Lists convey a hierarchical content structure. Lists should never be used to control indentation or layout.  List types should be used properly: <ul> should be used for lists with no order; <ol> for ordered lists; and <dl> for definition lists. If you don't want to see bullets displayed use style sheets to control the appearance of lists.

Blockquotes

Blockquotes should only be used if the content is a quotation.  Don’t use the blockquote tag to control indentation.  Use CSS for indentation.

Example:
<h1>Primary Topic</h1>
<p> text</p>

<h2>Subsidiary Topic</h2>
<p>Text relating to subsidiary topic</p>

There is no unanimous agreement on whether or not there can be more than one H1 tag per page.  Some feel that the H1 should represent the most important element on the page.  Others feel that a page may have multiple H1 instances if the content requires it.

Use ol, ul and dl for lists.

Definitions lists consist of two parts: a term and a description. The term is given by the DT element and is restricted to inline content. The description is given with a DD element that contains block-level content.

Here is an example from the W3C recommendations:
 
<DL>
  <DT>Dweeb
  <DD>young excitable person who may mature
    into a <EM>Nerd</EM> or <EM>Geek</EM>

  <DT>Hacker
  <DD>a clever programmer

  <DT>Nerd
  <DD>technically bright but socially inept person

</DL>

 

XHTML