curriculum/challenges/english/blocks/workshop-cafe-menu/5f716bee5838c354c728a7c5.md
Below the dessert you just added, add the rest of the desserts and prices using three more article elements, each with two nested p elements. Each element should have the correct dessert and price text, and all of them should have the correct classes.
Cherry Pie 2.75
Cheesecake 3.00
Cinnamon Roll 2.50
You should have four article elements in your second section.
const secondSection = document.querySelectorAll('section')[1]
const articles = secondSection.querySelectorAll('article')
assert.lengthOf(articles, 4)
You should have four .dessert elements.
assert.lengthOf(document.querySelectorAll('.dessert'), 4);
You should have four new .price elements.
const section = [...document.querySelectorAll('section')].at(-1);
const prices = section.querySelectorAll(`:scope ${'.price'}`);
assert.lengthOf(prices, 4);
Your section element should have eight p elements.
const section = [...document.querySelectorAll('section')].at(-1);
const paragraphs = section.querySelectorAll(`:scope ${'p'}`);
assert.lengthOf(paragraphs, 8);
Your .dessert elements should have the text Donut, Cherry Pie, Cheesecake, and Cinnamon Roll.
const dessert = document.querySelectorAll('.dessert');
assert.match(dessert?.[0]?.innerText.trim(), /donut/i);
assert.match(dessert?.[1]?.innerText.trim(), /cherry pie/i);
assert.match(dessert?.[2]?.innerText.trim(), /cheesecake/i);
assert.match(dessert?.[3]?.innerText.trim(), /cinnamon roll/i);
Your new .price elements should have the text 1.50, 2.75, 3.00, and 2.50.
const section = [...document.querySelectorAll('section')].at(-1);
const prices = section?.querySelectorAll(`:scope ${'.price'}`);
assert.match(prices?.[0]?.innerText.trim(), /1\.50/);
assert.match(prices?.[1]?.innerText.trim(), /2\.75/);
assert.match(prices?.[2]?.innerText.trim(), /3\.00/);
assert.match(prices?.[3]?.innerText.trim(), /2\.50/);
You should not have any spaces between your p elements.
assert.notMatch(code, /<\/p>\s+<p/);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cafe Menu</title>
<link href="styles.css" rel="stylesheet"/>
</head>
<body>
<div class="menu">
<main>
<h1>CAMPER CAFE</h1>
<p>Est. 2020</p>
<section>
<h2>Coffee</h2>
<article class="item">
<p class="flavor">French Vanilla</p><p class="price">3.00</p>
</article>
<article class="item">
<p class="flavor">Caramel Macchiato</p><p class="price">3.75</p>
</article>
<article class="item">
<p class="flavor">Pumpkin Spice</p><p class="price">3.50</p>
</article>
<article class="item">
<p class="flavor">Hazelnut</p><p class="price">4.00</p>
</article>
<article class="item">
<p class="flavor">Mocha</p><p class="price">4.50</p>
</article>
</section>
<section>
<h2>Desserts</h2>
<article class="item">
<p class="dessert">Donut</p><p class="price">1.50</p>
</article>
--fcc-editable-region--
--fcc-editable-region--
</section>
</main>
</div>
</body>
</html>
body {
background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg);
}
h1, h2, p {
text-align: center;
}
.menu {
width: 80%;
background-color: burlywood;
margin-left: auto;
margin-right: auto;
}
.item p {
display: inline-block;
}
.flavor, .dessert {
text-align: left;
width: 75%;
}
.price {
text-align: right;
width: 25%
}