Lab 04: Typography & Colors

🎯 Objective

Create and style unordered lists (<ul>), ordered lists (<ol>), and definition lists (<dl>), including nested lists.

πŸ“š Background

HTML offers three list types: unordered lists for items without sequence importance, ordered lists for sequential items, and definition lists for term-definition pairs. Lists are also used for navigation menus.

⏱️ Estimated Time

25 minutes

πŸ“‹ Prerequisites

  • Labs 1–3 completed

πŸ› οΈ Tools Used

  • Python 3, Web browser

πŸ”¬ Lab Instructions

Step 1: Create the lab file

Step 2: Create an unordered list

πŸ’‘ Use <ul> when the order of items doesn't matter (e.g., a shopping list, navigation menu).

Step 3: Create an ordered list

Step 4: Create a definition list

πŸ’‘ <dl> is perfect for glossaries, metadata, and key-value pairs.

Step 5: Create nested lists

πŸ’‘ You can mix <ul> and <ol> in nested structures.

Step 6: Use a list as navigation

πŸ’‘ Navigation menus are semantically lists of links. CSS list-style: none removes bullets.

Step 7: Validate the HTML

πŸ“Έ Verified Output:

Step 8: Style lists with CSS

Add to your <style> section:

πŸ“Έ Verified Output: In the browser, square bullets replace the default circles, and upper-roman shows I, II, III, etc.

βœ… Verification

🚨 Common Mistakes

  • <li> outside of <ul> or <ol> β€” Invalid HTML; list items need a parent list

  • Using <br> to create list-like layouts β€” Use proper list elements instead

  • Nesting <ul> directly inside <ul> β€” Must wrap in <li> first: <ul><li><ul>...</ul></li></ul>

  • Using lists just for indentation β€” Use CSS margin/padding for spacing

πŸ“ Summary

You mastered:

  • <ul> β€” Unordered lists with <li> items

  • <ol> β€” Ordered lists with start, reversed, and type attributes

  • <dl>, <dt>, <dd> β€” Definition lists for glossaries

  • Nested lists combining <ul> and <ol>

  • Navigation menus using styled lists

πŸ”— Further Reading

Last updated