Ingredient list
List ingredients as an unordered list and highlight quantities.
Ingredient list with ul and li
Ingredients form a list where order doesn't matter. So you use the <ul> (unordered list) tag. The browser puts a bullet in front of each item.
Each ingredient goes inside an <li> (list item). Example:
<ul>
<li>3 eggs</li>
<li>1 cup sugar</li>
</ul>Highlighting amounts with <strong> makes the list easier to scan.
Highlight amounts with strong
Making amounts important with <strong> in the ingredient list helps them stand out. Example:
<li><strong>3</strong> eggs</li>This visually separates the amount from the ingredient name. Consistency matters: use the same pattern for every item. Readers can scan amounts at a glance.
Exercise Add the ingredient list
Take the previous lesson's solution. Add an h2 with content Ingredients and a ul to <body>. Put at least 4 li items inside the ul; highlight each amount with strong.
Show example solution
Add h2 and ul to body. Put li items inside the ul.
Example solution:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Chocolate Cake</title>
</head>
<body>
<h1>Chocolate Cake</h1>
<p>A rich, <strong>cocoa-flavored</strong> cake recipe. About <em>8 slices</em> in 50 minutes.</p>
<h2>Ingredients</h2>
<ul>
<li><strong>3</strong> eggs</li>
<li><strong>1 cup</strong> sugar</li>
<li><strong>1 cup</strong> milk</li>
<li><strong>2 tbsp</strong> cocoa</li>
<li><strong>1 pack</strong> baking powder</li>
<li><strong>2 cups</strong> flour</li>
</ul>
<!-- add steps and baking table -->
</body>
</html>
Test yourself
-
Which tag is used for an ingredient list where order doesn't matter?
- <ol>
- <table>
- <ul>
- <dl>
Show answer
<ul> — Correct. <ul> marks an unordered list; ingredient order doesn't matter.
-
Complete the ingredient amount
<li><strong>____</strong> eggs</li>Show answer
<li><strong>3</strong> eggs</li> -
Match each list tag to its meaning
- <ul>
- Unordered list
- <ol>
- Ordered list
- <li>
- List item
- <dl>
- Description list