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 (bulleted lists)
  • Ordered lists (incrementing numbers or letters instead of bullets)
  • Definition lists (list term/definition pairs)

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.

Make Better Web Pages!

How to make your web site sell - use my secrets

Find out How

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

We'd love to hear about your web strategy.

Contact one of our team today!

Leave a comment

Articles + tutorials in HTML / CSS

Complete List of HTML/xHTML Tags, With Guide to Proper Semantic Use
My Complete List of HTML/xHTML Tags, With Guide to their Proper Semantic Use
Semantic HTML Handbook – Benefits of Writing Semantic HTML
Free article on Semantic HTML. Why you should learn Semantic HTML. Benefits for SEO and code reuse explained.
A Few Tips and Tricks to Write Better Semantic HTML
Tips and tricks for writing better semantic HTML or xHTML from a professional web producer
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
Keeping your content in order of priority with flexible CSS layouts.
How to keep your most important content at the top of your page, no matter what kind of column layout you wish to achieve.
Web page production with xHTML and CSS (ebook)
Introduction to Semantic HTML
A Basic Guide to writing semantically correct semantic HTML or xHTML markup
Anatomy of HTML/xHTML tags
HTML basics tutorial: Learn HTML tags, covering the most common attributes
Introduction to Cascading Style Sheets (CSS)
Beginner's introduction to Cascading Style Sheets (CSS), learn CSS.
Making a Tabular list in HTML
Create an appealing tabular list using HTML, CSS and JavaScript
How HTML, CSS and JavaScript work together in web pages
Best practice for using HTML, Cascading Style Sheets, and JavaScript together to make web pages.
HTML Tables – when and how to use tables in HTML
When to use tables in HTML, and how to do it properly
Block vs Inline display style in CSS
An article explaining the differences between block and inline display property in CSS. Gives examples of CSS Block vs Inline CSS and how they are applied in CSS/HTML files and pages.
Datasheet-style form using HTML and CSS
Make a datasheet-style web form using HTML, CSS and JavaScript
Inheritance and Cascading Styles in CSS Explained
Introduction to CSS inheritance and how styles apply in CSS through inheritance and cascading. Read this guide detailed guide on using CSS inheritance.
HTML Lists: unordered, ordered and definition lists
My guide to HTML lists explains the 3 main types of lists web browsers support and how to implement them in HTML / xHTML
HTML, how to code HTML/xHTML markup
Free HTML tutorials: Learn top-quality web page production skills using HTML/xHTML markup
Using CSS (Cascading Style Sheets)
Free tutorial on learning CSS for web design and development
Introduction to HTML – basics of HTML
Introduction to basic HTML tags and the structure of HTML documents.
© Scratchmedia Limited, 2006-2010
Floor 3, 111 Buckingham Palace Road, London, SW1W 0WQ, UK
+44 (0)207 1600 989