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

72 lines
1.3 KiB
Markdown
Raw Normal View History

---
id: 5f344f9c805cd193c33d829c
title: Passo 12
challengeType: 0
dashedName: step-12
---
# --description--
Você pode adicionar estilo a um elemento, especificando-o no elemento `style` e definindo uma propriedade para ele assim:
```css
element {
property: value;
}
```
Centralize seu elemento `h1` definindo sua propriedade `text-align` para o valor `center`.
# --hints--
Você deve adicionar um elemento `h1` ao elemento `style`.
```js
const hasSelector = new __helpers.CSSHelp(document).getStyle('h1');
assert(hasSelector);
```
Sua propriedade `text-align` deve ter um valor de `center`.
```js
const hasTextAlign = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['text-align'] === 'center');
assert(hasTextAlign);
```
O seletor `h1` deve definir a propriedade `text-align` para `center`.
```js
const h1TextAlign = new __helpers.CSSHelp(document).getStyle('h1')?.getPropertyValue('text-align');
assert(h1TextAlign === 'center');
```
# --seed--
## --seed-contents--
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Cafe Menu</title>
--fcc-editable-region--
<style>
</style>
--fcc-editable-region--
</head>
<body>
<header>
<h1>CAMPER CAFE</h1>
<p>Est. 2020</p>
</header>
<main>
<section>
<h2>Coffee</h2>
</section>
</main>
</body>
<html>
```