freeCodeCamp/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-basic-css-by-building.../5f716bee5838c354c728a7c5.md

154 lines
3.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
id: 5f716bee5838c354c728a7c5
title: Крок 53
challengeType: 0
dashedName: step-53
---
# --description--
Під щойно доданим десертом додайте решту десертів та ціни, використовуючи ще три елементи `article`, кожен з двома вкладеними елементами `p`. Кожен елемент повинен мати правильний текст з десертом та ціною, і всі повинні мати правильний клас.
```bash
Cherry Pie 2.75
Cheesecake 3.00
Cinnamon Roll 2.50
```
# --hints--
Ви повинні мати чотири елементи `article` в другому `section`.
```js
const secondSection = document.querySelectorAll('section')[1]
const articles = secondSection.querySelectorAll('article')
assert(articles.length === 4)
```
Ви повинні мати чотири елементи `.dessert`.
```js
assert($('.dessert').length === 4);
```
Ви повинні мати чотири нові елементи `.price`.
```js
assert($('section').last().find('.price').length === 4);
```
Ваш елемент `section` повинен мати вісім елементів `p`.
```js
assert($('section').last().find('p').length === 8);
```
Ваші елементи `.dessert` повинні мати текст `Donut`, `Cherry Pie`, `Cheesecake` та `Cinnamon Roll`.
```js
const dessert = $('.dessert');
assert(dessert[0].innerText.match(/donut/i));
assert(dessert[1].innerText.match(/cherry pie/i));
assert(dessert[2].innerText.match(/cheesecake/i));
assert(dessert[3].innerText.match(/cinnamon roll/i));
```
Ваші нові елементи `.price` повинні мати текст `1.50`, `2.75`, `3.00` та `2.50`.
```js
const prices = $('section').last().find('.price');
assert(prices[0].innerText.match(/1\.50/));
assert(prices[1].innerText.match(/2\.75/));
assert(prices[2].innerText.match(/3\.00/));
assert(prices[3].innerText.match(/2\.50/));
```
Ви не повинні мати жодних прогалин між елементами `p`.
```js
assert(!code.match(/<\/p>\s+<p/));
```
# --seed--
## --seed-contents--
```html
<!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">
<header>
<h1>CAMPER CAFE</h1>
<p>Est. 2020</p>
</header>
<main>
<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>
--fcc-editable-region--
<article class="item">
<p class="dessert">Donut</p><p class="price">1.50</p>
</article>
--fcc-editable-region--
</section>
</main>
</div>
</body>
</html>
```
```css
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%
}
```