2022-05-16 14:06:15 +00:00
|
|
|
---
|
|
|
|
id: 5f344f9c805cd193c33d829c
|
2022-10-18 07:29:49 +00:00
|
|
|
title: Step 11
|
2022-05-16 14:06:15 +00:00
|
|
|
challengeType: 0
|
2022-10-18 07:29:49 +00:00
|
|
|
dashedName: step-11
|
2022-05-16 14:06:15 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# --description--
|
|
|
|
|
|
|
|
Puoi aggiungere uno stile a un elemento specificandolo nell'elemento `style` e impostando una proprietà in questo modo:
|
|
|
|
|
|
|
|
```css
|
2022-07-06 15:33:30 +00:00
|
|
|
elemento {
|
|
|
|
proprietà: valore;
|
2022-05-16 14:06:15 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Centra l'elemento `h1` assegnando alla proprietà `text-align` il valore `center`.
|
|
|
|
|
|
|
|
# --hints--
|
|
|
|
|
|
|
|
Dovresti avere un selettore `h1` nell'elemento `style`.
|
|
|
|
|
|
|
|
```js
|
|
|
|
const hasSelector = new __helpers.CSSHelp(document).getStyle('h1');
|
|
|
|
assert(hasSelector);
|
|
|
|
```
|
|
|
|
|
|
|
|
La proprietà `text-align` dovrebbe avere il valore `center`.
|
|
|
|
|
|
|
|
```js
|
|
|
|
const hasTextAlign = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['text-align'] === 'center');
|
|
|
|
assert(hasTextAlign);
|
|
|
|
```
|
|
|
|
|
|
|
|
Il selettore `h1` dovrebbe assegnare alla proprietà `text-align` il valore `center`.
|
|
|
|
|
|
|
|
```js
|
|
|
|
const h1TextAlign = new __helpers.CSSHelp(document).getStyle('h1')?.getPropertyValue('text-align');
|
|
|
|
assert(h1TextAlign === 'center');
|
|
|
|
```
|
|
|
|
|
|
|
|
# --seed--
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
```html
|
|
|
|
<!DOCTYPE html>
|
2022-06-28 13:30:45 +00:00
|
|
|
<html lang="en">
|
2022-05-16 14:06:15 +00:00
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
<title>Cafe Menu</title>
|
|
|
|
--fcc-editable-region--
|
|
|
|
<style>
|
|
|
|
</style>
|
|
|
|
--fcc-editable-region--
|
|
|
|
</head>
|
|
|
|
<body>
|
2022-10-18 07:29:49 +00:00
|
|
|
<main>
|
2022-10-11 18:26:51 +00:00
|
|
|
<h1>CAMPER CAFE</h1>
|
|
|
|
<p>Est. 2020</p>
|
2022-05-16 14:06:15 +00:00
|
|
|
<section>
|
|
|
|
<h2>Coffee</h2>
|
|
|
|
</section>
|
|
|
|
</main>
|
|
|
|
</body>
|
2022-06-28 13:30:45 +00:00
|
|
|
</html>
|
2022-05-16 14:06:15 +00:00
|
|
|
```
|
|
|
|
|