91 lines
2.1 KiB
Markdown
91 lines
2.1 KiB
Markdown
---
|
|
id: 5f35e5c44359872a137bd98f
|
|
title: Step 28
|
|
challengeType: 0
|
|
dashedName: step-28
|
|
---
|
|
|
|
# --description--
|
|
|
|
Dal momento che il prodotto principale del bar è il caffè, puoi utilizzare un'immagine con dei chicchi di caffè per lo sfondo della pagina.
|
|
|
|
Elimina il commento e il suo contenuto all'interno del selettore di tipo `body`. Ora aggiungi una proprietà `background-image` e assegnale il valore `url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg)`.
|
|
|
|
# --hints--
|
|
|
|
Dovresti rimuovere la proprietà `background-color` che avevi trasformato in un commento.
|
|
|
|
```js
|
|
assert(!code.match(/\/\*\s*background-color:\s*burlywood;?\s*\*\//i))
|
|
```
|
|
|
|
Il selettore `body` non dovrebbe avere commenti.
|
|
|
|
```js
|
|
assert(!code.match(/body\s*{\s*\/\*/i));
|
|
```
|
|
|
|
Dovresti assegnare alla proprietà `background-image` il valore `url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg)`.
|
|
|
|
```js
|
|
const hasBackground = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['background-image'] === `url("https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg")`)
|
|
assert(hasBackground)
|
|
```
|
|
|
|
L'elemento `body` dovrebbe avere un'immagine di sfondo con dei chicchi di caffè.
|
|
|
|
```js
|
|
const bodyBackground = new __helpers.CSSHelp(document).getStyle('body')?.getPropertyValue('background-image');
|
|
console.log(bodyBackground);
|
|
assert(bodyBackground === `url("https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg")`);
|
|
```
|
|
|
|
# --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">
|
|
<main>
|
|
<h1>CAMPER CAFE</h1>
|
|
<p>Est. 2020</p>
|
|
<section>
|
|
<h2>Coffee</h2>
|
|
</section>
|
|
</main>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
```
|
|
|
|
```css
|
|
--fcc-editable-region--
|
|
body {
|
|
/*
|
|
background-color: burlywood;
|
|
*/
|
|
}
|
|
--fcc-editable-region--
|
|
|
|
h1, h2, p {
|
|
text-align: center;
|
|
}
|
|
|
|
.menu {
|
|
width: 80%;
|
|
background-color: burlywood;
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
}
|
|
```
|
|
|