Lists

Now that I've covered the basics of HTML, let's talk about one of the first things that was ever included in HTML code: lists. Lists are basically either numbered (ordered) or bulletized (unordered). Like when you are making a Word document or PowerPoint presentation. You can even make fancy little symbols for your bullets and have lists nested within lists.

Let's look at the tags involved. First comes the <ul> tag. This stands for "unordered list" and results in bullet list items (little dots). Then comes <ol> or "ordered list" which numbers the list items (you can customize both types with attributes, but this is now relegated to the style sheet if using strict XHTML). Now comes <li> or "list item". This is self explanatory.

Here's some code and examples for you. Just take the file you used in the last lesson and replace everything between the <body> tags with this:

<p>What are my reasons for learning HTML?</p>
<ul>
<li>To create my own web pages.</li>
<li>To have better control over web pages I already own.</li>
<li>To make a profit one day as a web designer.</li>
</ul>

Here's what your unordered list page should look like. Feel free to change the <ul> tag with an <ol> tag to see how it looks then (don't forget the closing tag too).

You can also make something called a definition list <dl>. This looks like so:

<dl>
<dt>Coffee</dt>
<dd>Black hot drink</dd>
<dt>Milk</dt>
<dd>White cold drink</dd>
</dl>

And here's how it would look on your page:

Coffee
Black hot drink
Milk
White cold drink

That's pretty much it for lists. Again, you can refine lists more with things like using letters or Roman numerals and even get fancy on the bullets, but all that is now relegated to CSS in the stylesheets. We will look at those in the not so far future. See you tomorrow for links, images and some basic formatting.

<<--  Back ...  Next  -->>


Leave a Reply

Your email address will not be published. Required fields are marked *

*

5 visitors online now
0 guests, 5 bots, 0 members
Max visitors today: 8 at 06:10 am HST
This month: 13 at 02-01-2012 09:43 pm HST
This year: 13 at 02-01-2012 09:43 pm HST
All time: 72 at 03-07-2010 11:16 am HST