|
Section 6: Introduction to HTML Lists
Note: You can change your user name at any time from this page. Just click the Change name link above.
Bookmark this page now if you think you might want to change your user name later.
In this section you will learn how to create several kinds of HTML lists.
As you have already learned, there is no HTML tag that can be used for indenting.
To indent a paragraph you have to use HTML space codes. When you need to create
numbered, unnumbered, or other types of lists, you usually need to use indenting.
It is next to impossible to use space codes to align lists, because people who
look at your pages on the Internet use many different sizes of monitors, many
different screen resolutions, and various font sizes. Those things affect the length
of each line of text, and that means that you can never know where the text will
wrap to the next line. Take a look at the following examples. Let's say you want to
create a page with a list that looks like this:
Common Types of Software
- 1. Word Processors
- Word processing software is probably the most commonly used type of software.
It is used to write letters, reports, books, and even web pages.
- 2. Spreadsheets
- Spreadsheet software is used to store and calculate rows and columns of numbers.
Businesses use spreadsheets to keep financial records.
- 3. Databases
- Database software is used to store data that can be classified into categories.
Libraries, for example, keep a record of each book in a database.
|
One way to indent the lines is to use spaces, or space codes
( ). That will work only as long as everyone else in the world has the same
monitor size and screen resolution as yours. They must also be using the same font size,
and have their browser windows set to the same size as yours.
If all of these conditions are not exactly the same, something like the following can happen:
Common Types of Software
1. Word Processors
Word processing software is probably the most
commonly used type of software.
It is used to write letters, reports, books, and even web pages.
2. Spreadsheets
Spreadsheet software is used to store and calculate rows and columns of
numbers. Businesses use spreadsheets to
keep financial records.
3. Databases
Database software is used to store data that can be
classified into categories.
Libraries, for example, keep a record of each book in a database.
|
Because the lines are shorter, they wrap in different places, putting the
spaces where you don't expect them to be.
Another way to go about this is to use line break tags. If you use
BR tags, you can be sure the lines will break (wrap) exactly where you want them to.
Let's say you put BR tags at the end of each line in your original file,
and indent using space codes. Look at what happens when you do that:
Common Types of Software
1. Word Processors
Word processing software is probably the most
commonly used type of software.
It is used to write letters, reports, books, and even web pages.
2. Spreadsheets
Spreadsheet software is used to store and calculate rows and columns of
numbers. Businesses use spreadsheets to
keep financial records.
3. Databases
Database software is used to store data that can be
classified into categories.
Libraries, for example, keep a record of each book in a database.
|
It looks even worse now. You can see that the
lines wrap exactly where the BR tags were put. But since this page is narrower than your
original page, the lines also wrap in other places as well - wherever the text comes to the right
edge of the page. That pushes many of your line break tags to the next line.
Your line breaks are now in places where you don't want them to be.
You can see now that space codes and line break tags cannot align your list correctly,
because there are so many different sizes of computer screens.
You can never be sure where a line will wrap on someone else's screen.
HTML has several ways to solve this problem of aligning text in lists.
In fact, it is very easy to create lists in HTML.
In this section you will learn how to build three basic types of lists: numbered lists,
bulleted lists, and definition lists.
Review:
- There are many different sizes of computer screens and screen resolutions.
People can also change the size of their browser window, and their font size at any time.
That means that lines on the user's page are not always the same length as on your original page.
Lines of text should flow gracefully.
- Spaces and line break tags are not suitable for aligning text in lists.
- HTML provides ways to build several different types of lists.
|