|
HTML Is Your Friend/ pg.6 CHAPTER 4: LISTS Now we are off to the wonderful world of lists. Lists can be a useful and informative addition to any website, providing that you place the lists in strategic places. Design-wise, I mean. Unordered Lists Unordered lists are the easier of the three types allowed in HTML. This type of list looks like the ones you are accustomed to. List items are preceeded by a bullet, a little black dot of moderate size.
|
|||||
|
Since little black dots get somewhat boring after a while, you can change the shape of the bullet. There are squares, and open circles, and open squares, and... um.. that's about it. Well, that's still quite a selection, isn't it? The type attribute in the <ul> tag allows you to select which bullet type you would like. Now here's all the quick technical info: |
|||||
| Quick Information: <ul> | |||||
| Start Tag | End Tag | ||||
| Is it needed? | required | required | |||
| How it looks: | <ul> | </ul> | |||
| What it does | This tag defines an area to be formatted as an unordered list. | ||||
| Attributes:Name | Values | What it does | |||
| type= | disc circle square |
This attribute will define the shape of the bullet that precedes each list item. | |||
| Quick Information: <li> | |||||
| Start Tag | End Tag | ||||
| Is it needed? | required | optional | |||
| How it looks: | <li> | </li> | |||
| What it does | This tag defines the following content as a single item in an unordered or ordered list. Each <li> is preceeded by a bullet (unordered) or a number/letter (ordered). | ||||
| Attributes:Name | Values | What it does | |||
| There are attributes. You don't need to know about them just right now. You will soon, though. | |||||
| Example - Unordered Lists | |||||
|
<ul> <li>This is a list item</li> <li>And this is another</li> </ul> | |||||
If you had the list code in the rest of the HTML (I'm somewhat lazy) then you would get something like the example above. See the bullet? Ordered lists are basically just like unordered lists, but each list item is numbered/lettered. Ordered lists are the type that you see above in the chpater outlines. Instead of making a list and numbering it by hand, ordered lists make the browser do the work! Each item is numbered sequentially, i.e., 1,2,3,4.... or a,b,c,d.... There are many options on the type of numbering, such as Arabic numbers (the ones we normally use), Roman numerals, upper-case or lower-case, and Latin characters, upper- and lower-case. Another handy feature that ordered lists allow you to do is to start the numbering at a number other than 1! (or a letter other than "a")
|
|||||
| Quick Information: <ol> | |||||
| Start Tag | End Tag | ||||
| Is it needed? | required | required | |||
| How it looks: | <ol> | </ol> | |||
| What it does | This tag defines an area to be formatted as an ordered list. | ||||
| Attributes:Name | Values | What it does | |||
| type= | 1 a A i I |
This attribute will determine the type of number before each item. NOTE: this is one of the few times when anything is CASE-SENSITIVE. You can pick capital letters of Roman numerals. |
|||
| start= | whatever your heart desires; numerically, of course | Like its name suggests, you can determine where the numbering will start. Sorry, negative numbers not allowed. | |||
| Quick Information: <li> - ordered list version | |||||
| Attributes:Name | Values | What it does | |||
| type= | 1 a A i I |
This attribute will determine the type of number before each item. NOTE: this is one of the few times when anything is CASE-SENSITIVE. You can pick capital letters of Roman numerals. |
|||
| Example - Ordered Lists | |||||
| <ol start=5> <li>Number five; thought you were going to get number 1, eh?</li> <li type=a>little letter "f";see, it keeps the same order; "f" is letter no. 6 </li> <li type=i>little numeral "vii"</li> </ol> |
|||||
|
|
Nice example, eh? I think so. Before we leave ordered lists, I have to tell you about some defaults:
Definition lists are used when you want to define a bunch of terms. There are two visible elements: the definition term and the definition. The term obviously is what you want to define. The definition... well, that's self explanatory. When you employ a definition list in your webpage, the term is flush with the left margin, followed by an empty line, and then the definition, which is indented. You can take a look at the example.
|
||||
| Quick Information: <dl> | |||||
| Start Tag | End Tag | ||||
| Is it needed? | required | required | |||
| How it looks: | <dl> | </dl> | |||
| What it does | This tag defines an area to be formatted as a definition list. | ||||
| Quick Information: <dt> | |||||
| Start Tag | End Tag | ||||
| Is it needed? | required | optional | |||
| How it looks: | <dt> | </dt> | |||
| What it does | This tag determines the content to be formatted as a definition term. | ||||
| Quick Information: <dd> | |||||
| Start Tag | End Tag | ||||
| Is it needed? | required | optional | |||
| How it looks: | <dd> | </dd> | |||
| What it does | This tag defines an area to be formatted as a definition data, aka the definition for the term. | ||||
| Example - Definition Lists | |||||
|
<dl> <dt>HTML</dt> <dd>Hypertext Markup Language. Developed by physicist Timothy Berners-Lee in the early 1990s. A flexible computer language designed for the World Wide Web.</dd> </dl> |
|||||
Nesting Lists No, this is not another type of list. What I am writing about is what happens when you nest lists.
|
|||||
| <tag1><tag2><tag3>some text to be formatted</tag3></tag2></tag1> | |||||
|
I'm discussing nesting because you can nest lists, to accomplish an outline type effect, like the one used in the list of chapter contents above. As you can see, a list in the place of "tag2" will be indented a bit further than a list in the place of "tag1". In unordered and ordered lists, there is the increased indent . In unordered lists, as you nest, the bullet will change shape. The shape is determined by whichever browser the reader is using. Well, another chapter bites the dust. Alright, if you think you're ready for Chapter 3: Text Format Tags, then click on, young Skywalker. Oh wait, this isn't Star Wars... |
|||||