Chapter 1: Lists

 < Day Day Up > 



Lists. They're found in just about any page on the Web. Lists of hyperlinks, lists of items in a shopping cart, lists of your favorite movies—even lists for the navigation of an entire website. While it might seem arbitrary to some, how we mark up these lists is what we'll explore, discovering the advantages (and disadvantages) of a few common methods. Later, we'll put those advantages to the test with several examples on how to style an ordinary list.

Let's Go Shopping

Initially, I thought about using a laundry list as the example for the chapter, but then quickly realized that I have no idea what items would be included in such a list. So for this example's sake, groceries it is ...

Let's imagine that you needed to mark up a simple grocery list for inclusion on your personal website. You may be wondering what place a grocery list has on any website, but that's beside the point. We just need a reason to start thinking about lists.

On the page, say we'd like the grocery list to look like ... well, a list—a vertical series of items, each on their own line:

Apples

Spaghetti

Green Beans

Milk

A seemingly simple task, right? Now, like all facets of web design and development, there are a variety of ways we could attack this to achieve the same (or similar) results. As in all examples found throughout this book, I'll be presenting things from an eXtensible HyperText Markup Language (XHTML) point of view—making sure that the methods chosen are valid markup and adhere to the standards outlined by the World Wide Web Consortium (W3C, www.w3.org/).

We could simply add a <br /> tag after each item and be done with it, or we could tap into various list elements to get the job done. Let's look at three different possibilities, and the consequences of using each of them.



 < Day Day Up > 



Web Standards Solutions. The Markup and Style Handbook
Web Standards Solutions: The Markup and Style Handbook (Pioneering Series)
ISBN: 1590593812
EAN: 2147483647
Year: 2003
Pages: 119
Authors: Dan Cederholm

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net