G

 

Semantics

 

<< Previous    1  2  [3]    Next >>

You have three types of lists to choose from, but choose wisely. There are Ordered Lists (< ol >), Unordered Lists (< ul >), and Definition Lists (< dl >). Only use Ordered Lists when the entries have some kind of order. Use Definition Lists any time you need name/value pairs, or when you need to break your list up into sections. The rest of the time, Unordered Lists are a safe bet.

Lists not only give structure to your page, they're incredible handy for styling. You can just put an id or class on the outer tag (eg. < ul >), then style both the outer tag, and the inner < li > tags.

Conclusion

Try to use the full variety of HTML tags whenever possible. Sometimes you'll be stuck with using < div > tags, but try to limit them to whenever you can't find a suitable HTML equivalent. At the same time, try to avoid using HTML tags for anything except their intended purpose. By doing this, your HTML will be cleaner, and its structure will be more readable and understandable -- not just to people but to screen readers, search engines, and other programs and tools.

---

Jesse Skinner is a freelancing web developer, passionate about the potential of the Internet to change the world. On his blog, The Future of the Web, he shares HTML, CSS and JavaScript tips, and discusses anything of interest to standards-loving web developers and designers.

To read more, visit:

http://www.thefutureoftheweb.com

<< Previous    1  2  [3]    Next >>