Creating Lists and Tables

Lists are both quick and easy. There are two kinds of lists: ordered (that is, numbered) and unordered (that is, bulleted). First, specify which kind of list you want:

  • Ordered list: <ol></ol>

  • Unordered list: <ul></ul>

Then, between the opening and closing list tags, introduce each new item on the list with a list item <li> tag. Here's an example; the results are in Figure B-5:

			<ol>
			<li>Here's
			<li>a
			<li>numbered
			lt;li>list.
			lt;/ol>
			lt;ul>
			<li>Here's
			<li>a
			<li>bulleted
<li>list.
			</ul>
The <ol> tag defines an automatically numbered list. The <ul> tag defines a bulleted list.

Figure B-5. The <ol> tag defines an automatically numbered list. The <ul> tag defines a bulleted list.

By the way, you don't have to put each tag on its own line. You could just as easily write the HTML like this:

	<ol><li>Here's<li>a<li>numbered<li>list.</ol><	ul><li>Here's<li>a<li> 
	bulleted<li>list.</ul>

The code without line breaks is harder for humans to read, but browsers ignore line breaks in your HTML document (unless you type them in using the <br> or the <p> tag). So it doesn't matter how many times you hit Enter; the list appears the same as it does if you mushed everything together on one line. Because you're a human, though, when you're typing a list into an HTML document, it's easier to read your work if you put each list item on its own line.

Tables

Because HTML ignores spaces and line breaks, you need a special format if you want to control layout and positioning precisely. ...

Get eBay: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.