New eBookNew eBook - Web page production with xHTML and CSS #1

Experience the thought process of a professional web producer as he guides you through the web page production process, from photoshop design to working HTML template.

The book tells you how to approach web production, beginning with semantic HTML, guiding you through how to slice up a photoshop document, and finally how to use CSS for presentation.

Buy Now for £9.00 GBP

New eBookNew eBook - Guide to Semantic HTML

Ben Hunt adds another great eBook to the collection with his "Guide to Semantic HTML". The book gives you advice and tips on how, and why to use semantic HTML.

Included is a comprehensive list of HTML tags, each with their semantically appropriate uses, along with a worked example taking you through the process of how to build a website using semantic HTML.

Get “Guide to Semantic HTML” now for £5.00

Semantic use of lists

It's good to write HTML code that is semantically correct, which means that the HTML structures and elements you use accurately describes the structure of the information.

Use a list whenever you have a repeated list of items in your content. This will look fine in a regular web browser, and will also help other user agents (like text-to-speech screen readers, other non-graphical browsers and search engine spiders) to interpret the structure of the content on the page accurately.

There are 3 types of lists:

Unordered lists <ul>

Unordered lists are simple bulleted lists. Use when there is no particular order to the items, when you won't need to cross-reference an item to other content elsewhere.

Elements

<ul> ... </ul>
Unordered list; paired tag.
<li> ... </li>
List item; paired tag.
 

Example

<ul>
  <li>Item one</li>
  <li>Item two</li>
  <li>Watch, you can easily nest list items: This item has some sub-items</li>
  <ul>
    <li>Sub-item one</li>
    <li>Sub-item two</li>
    <li>Shall we do a 3rd nested list?</li>
    <ul>
      <li>OK</li>
      <li>Your browser should automatically use different bullet styles for each level.</li>
    </ul>
  </ul>
</ul>

Looks like

  • Item one
  • Item two
  • Watch, you can easily nest list items: This item has some sub-items
    • Sub-item one
    • Sub-item two
    • Shall we do a 3rd nested list?
      • OK
      • Your browser should automatically use different bullet styles for each level.

Ordered lists <ol>

Ordered lists are similar to unordered lists, but with a numbering (or lettering) order applied by the browser.

Elements

<ol> ... </ol>
Ordered list; paired tag.
<li> ... </li>
List item; paired tag.
 

Example

<ol style="list-style-type:decimal;">
  <li>Item one</li>
  <li>Item two</li>
  <li>Watch, you can easily nest list items: This item has some sub-items</li>
  <ol style="list-style-type:lower-alpha;">
    <li>Sub-item one</li>
    <li>Sub-item two</li>
    <li>Shall we do a 3rd nested list?</li>
    <ol style="list-style-type:lower-roman;">
      <li>OK</li>
      <li>Your browser should automatically use different bullet styles for each level.</li>
    </ol>
  </ol>
</ol>

Looks like

  1. Item one
  2. Item two
  3. Watch, you can easily nest list items: This item has some sub-items
    1. Sub-item one
    2. Sub-item two
    3. Shall we do a 3rd nested list?
      1. OK
      2. Your browser should automatically use different bullet styles for each level.

Note that, while I've used the type attribute to set the sort of numbers/characters applied, it is better to do this in CSS than in HTML.

Definition lists

Definition lists are for lists of term/definition pairs.

Elements

<dl> ... </dl>
Definition list; paired tag.
<dt> ... </dt>
Definition term; paired tag.
<dd> ... </dd>
Definition definition; paired tag.
 

Example

<dl>

  <dt> The dl element </dt>
  <dd>Paired tags define the start and end of a definition list.</dd>

  <dt> The dt element </dt>
  <dd>Paired tag that indicates the term being defined.</dd>

  <dt> The dd element </dt>
  <dd>Paired tag that indicates the definition of the term. Each term should be followed by a definition.</dd>

</dl>

Looks like

The dl element
Paired tags define the start and end of a definition list.
The dt element
Paired tag that indicates the term being defined.
The dd element
Paired tag that indicates the definition of the term. Each term should be followed by a definition.

There are lots of other ways you can structure content of this type (e.g. in a table, or using sub-headings), but if it matches this pattern, it's best to use a definition list, because it clearly indicates the relationships between the terms & definitions to any software looking at your page.

Do you love our approach to crafting simple & effective web sites that just work for people?

To make your web project a success, contact Scratchmedia for Great Web Design - guaranteed!

Search this site
Pro Tips
Learn how to make fantastic web site designs..
Buy "Save the Pixel" now!
On “Save the Pixel”
Clicss templates, great robust useful CSS templates from £40
Share this Article
Send to a friend now&hellip
Follow Ben Hunt on Twitter
Floor 3
111 Buckingham Palace Road
London
SW1W 0WQ
UK
Phone
+44 (0)207 1600 989

Articles + tutorials in HTML & CSS Production

Overview
Menu of all our articles on HTML, CSS and web page production
CSS
List of our CSS articles
Introduction to CSS
Beginner's introduction to Cascading Style Sheets (CSS)
HTML
List of HTML articles
Introduction to HTML
Introduction to basic HTML tags and the structure of HTML documents.
How HTML, CSS and JavaScript work together in making web pages
Best practice for using HTML, Cascading Style Sheets, and JavaScript together to make web pages.
Building a web page with HTML + CSS for complete beginners
Learn what HTML is and how to build a website from scratch. A guide to creating a web page using HTML and CSS for people with no prior knowledge
Block vs Inline display style in CSS
HTML elements can be displayed either in block or inline style. The difference between these is one of the most basic things you need to know in order to use CSS effectively.
Inheritance and Cascading Styles in CSS
Introduction to how styles apply in CSS through inheritance and cascading.
HTML Lists
The basics of lists: unordered, ordered and definition lists covered.
HTML Tables
The basics of tables. When to use tables, and how to do it. Includes tips on colspan and rowspan properties, and the col and colgroup tags.
Anatomy of HTML tags
Describes the common attributes that can feature in your HTML tags.
Introduction to Semantic HTML
Explains what semantic HTML, or semantically-correct HTML, is and how it benefits web development.
Semantic HTML Handbook - Benefits of Writing Semantic HTML (Nov 15 2009)
Free article on Semantic HTML. Why you should learn Semantic HTML. Benefits for SEO and code reuse explained.
Complete List of HTML/xHTML Tags, With Guide to Proper Semantic Use (Nov 15 2009)
My Complete List of HTML/xHTML Tags, With Guide to their Proper Semantic Use
A Few Tips and Tricks to Write Better Semantic HTML (Nov 15 2009)
Tips and tricks for writing better semantic HTML or xHTML from a professional web producer
Web Page Production using xHTML and CSS (ebook)
This new 61-page ebook provides a worked example of web production, taking you through the entire process from a Photoshop page design, to a working HTML page template.
Datasheet-style form using HTML, CSS and JavaScript
Make a datasheet-style web form using HTML, CSS and JavaScript
Tabular list-style form using HTML, CSS and JavaScript
Create an appealing tabular list using HTML, CSS and JavaScript
Complete HTML tag reference
Our complete guide to HTML and xHTML tags, and their proper usage.
Keeping your content in order of priority with flexible CSS layouts
This article shows you how to use CSS floats to achieve any column layout, while keeping your most important content highest on the page.