All parts of this HTML guide for Everything 2 include:
(all chapters)   |   Overview/Contents/Index   |   Tags and Starting New Lines   |   Character Formatting   |   Special Characters   |   Lists   |   Giving Credit Where Credit is Due   |   Miscellaneous Tags   |   EOF: Index and Information   |   Tables   |   (Quick Start)


4: Lists

Following are some words that can be used in an interrogative sentence:

  • What
  • if
  • you
  • want
  • to
  • list
  • things?

Sure, you could use lots of <br />, but there is are some HTML tags that are dedicated to creating lists that look nicer than brute forcing it. To create a list, one pair of tags are used once, which specify which type of list to create, and another pair or two are used repeatedly for each item in the list.



4.1: Numbered and Bulleted Lists

Creating a list that has bullets (which are basically dots) or numbers in front of each item requires several steps.

  1. First, decide if bullets or numbers are more appropriate for the given list. (Generally, use bullets when the order is not important, and numbering when it is. I am unable to come up with any examples right now, but maybe you can think of some.)
  2. Second, place the appropriate tag.
    • If you want bullets, like what is in front of this line, put in a <ul>. This stands for unordered list.
    • If you want numbers, like the steps in these instructions have, use the <ol> tag. This means ordered list.
  3. Third, put a <li> before each list item, and a closing </li> after each item.
  4. Finally, close this list with either </ul> or </ol> (the closing tag should match whatever opening tag you used).

To illustrate:
          <ul>
          <li>This is [first]</li>
          <li>This is [second]</li>
          </ul>
produces:

and:
          <ol>
          <li>This is [first]</li>
          <li>This is [second]</li>
          </ol>
produces:

  1. This is first
  2. This is second

Notice that the only difference between an unordered (bulleted) and ordered (numbered) list is only the main opening and closing list tags. (You may also notice that if you nest bulleted items, the bullet may change.)


4.1.1: Numbers/Numerals/Outline

You can also use the <ol> tag to create outlines by adding the type attribute. To do this, instead of a plain <ol> to start an ordered list, use <ol type="n"> instead. The n can be one of several things, as shown below:

  1. <ol type="I">
  2. Please
    1. <ol type="A">
    2. don't
      1. <ol type="1"> (default, if no "type" is given)
      2. sneeze
        1. <ol type="a">
        2. on
          1. <ol type="i">
          2. me.

The types do not have to be in that order; they can be nested multiple times, with any "type" repeated any number of times.

It is also possible to fake resuming a previously-started list by using the start attribute:
          <ol type="I" start="3">
          <li>resume the outline</li>
          </ol>
which displays as:

  1. resume the outline

Note that the start value is not what is should look like (in this case, "III" in Roman numerals), but in Hindu-Arabic numerals ("normal" numbers).



4.2: Definition Lists

Definition lists are rarely used on the web, let alone Everything (except by me, who overuses them), so I'll let you skip to the next chapter, if you so desire.
Since you may not have seen this tag set in use before, I'll first show you an example.

A-wing
Fast but weak.
B-wing
Slow but strong.
N-Wing
That would be me.
Not a "real" Star Wars fighter.
This code produced the above:
          <dl>
          <dt>[A-wing]</dt> <dd>[Fast] but [weak].</dd>
          <dt>[B-wing]</dt> <dd>[Slow] but [strong].</dd>
          <dt>[N-Wing]</dt>
          <dd>That would be me.</dd>
          <dd><em>Not</em> a "real" [Star Wars] fighter.</dd>
          </dl>

To make a definition list, first put in the open and close tags: <dl> and </dl> . For each definition, surround the definition term with <dt> and </dt>, and the definition definition (sic) with <dd> and </dd>. The <dt> and <dd> tags may be repeated multiple times without having the other, but normally (that means, check any dictionary), the term is first, and the definition[s] follow.
I sometimes use these tags to list references I used - I put the reference name and author in the term tags, and longer, more detailed explanation of the source, and my thoughts on it, in the definition tags. This can be used with tags explained in the next chapter.


previous: Chapter 3: Special Characters     |     next: Chapter 5: Giving Credit Where Credit is Due

Log in or register to write something here or to contact authors.