172 lines
4.3 KiB
Markdown
172 lines
4.3 KiB
Markdown
---
|
|
id: 614202874ca576084fca625f
|
|
title: Passo 16
|
|
challengeType: 0
|
|
dashedName: step-16
|
|
---
|
|
|
|
# --description--
|
|
|
|
Cada função `region` requer um rótulo visível, que deve ser referenciado pelo atributo `aria-labelledby`.
|
|
|
|
Para os elementos `section`, forneça os seguintes atributos `aria-labelledby`:
|
|
|
|
- `student-info`
|
|
- `html-questions`
|
|
- `css-questions`
|
|
|
|
Então, dentro de cada elemento `section`, aninhe um elemento `h2` com um `id` que corresponda ao atributo `aria-labelledby` correspondente. Dê a cada `h2` conteúdo de texto adequado.
|
|
|
|
# --hints--
|
|
|
|
Você deve dar ao primeiro elemento `section` um atributo `aria-labelledby` de `student-info`.
|
|
|
|
```js
|
|
assert.equal(document.querySelectorAll('section')?.[0]?.getAttribute('aria-labelledby'), 'student-info');
|
|
```
|
|
|
|
Você deve dar ao segundo elemento `section` um atributo `aria-labelledby` de `html-questions`.
|
|
|
|
```js
|
|
assert.equal(document.querySelectorAll('section')?.[1]?.getAttribute('aria-labelledby'), 'html-questions');
|
|
```
|
|
|
|
Você deve dar ao terceiro elemento `section` um atributo `aria-labelledby` de `css-questions`.
|
|
|
|
```js
|
|
assert.equal(document.querySelectorAll('section')?.[2]?.getAttribute('aria-labelledby'), 'css-questions');
|
|
```
|
|
|
|
Você deve aninhar um elemento `h2` dentro do primeiro elemento `section`.
|
|
|
|
```js
|
|
assert.equal(document.querySelectorAll('section')?.[0]?.querySelectorAll('h2')?.length, 1);
|
|
```
|
|
|
|
Você deve aninhar um elemento `h2` dentro do segundo elemento `section`.
|
|
|
|
```js
|
|
assert.equal(document.querySelectorAll('section')?.[1]?.querySelectorAll('h2')?.length, 1);
|
|
```
|
|
|
|
Você deve aninhar um elemento `h2` dentro do terceiro elemento `section`.
|
|
|
|
```js
|
|
assert.equal(document.querySelectorAll('section')?.[2]?.querySelectorAll('h2')?.length, 1);
|
|
```
|
|
|
|
Você deve dar ao primeiro elemento `h2` um atributo `id` de `student-info`.
|
|
|
|
```js
|
|
assert.equal(document.querySelectorAll('h2')?.[0]?.id, 'student-info');
|
|
```
|
|
|
|
Você deve dar ao segundo elemento `h2` um atributo `id` de `html-questions`.
|
|
|
|
```js
|
|
assert.equal(document.querySelectorAll('h2')?.[1]?.id, 'html-questions');
|
|
```
|
|
|
|
Você deve dar ao terceiro elemento `h2` um atributo `id` de `css-questions`.
|
|
|
|
```js
|
|
assert.equal(document.querySelectorAll('h2')?.[2]?.id, 'css-questions');
|
|
```
|
|
|
|
Você deve dar ao primeiro elemento `h2` um conteúdo de texto adequado. _Dica: eu teria escolhido `Student Info`_
|
|
|
|
```js
|
|
assert.isAtLeast(document.querySelectorAll('h2')?.[0]?.textContent?.length, 1);
|
|
```
|
|
|
|
Você deve fornecer ao segundo elemento `h2` um conteúdo de texto adequado. _Dica: eu teria escolhido `HTML`_
|
|
|
|
```js
|
|
assert.isAtLeast(document.querySelectorAll('h2')?.[1]?.textContent?.length, 1);
|
|
```
|
|
|
|
Você deve fornecer ao terceiro elemento `h2` um conteúdo de texto adequado. _Dica: eu teria escolhido `CSS`_
|
|
|
|
```js
|
|
assert.isAtLeast(document.querySelectorAll('h2')?.[2]?.textContent?.length, 1);
|
|
```
|
|
|
|
# --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" />
|
|
<meta name="description" content="freeCodeCamp Accessibility Quiz practice project" />
|
|
<title>Accessibility Quiz</title>
|
|
<link rel="stylesheet" href="styles.css" />
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<img id="logo" src="https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg">
|
|
<h1>HTML/CSS Quiz</h1>
|
|
<nav>
|
|
<ul>
|
|
<li><a>INFO</a></li>
|
|
<li><a>HTML</a></li>
|
|
<li><a>CSS</a></li>
|
|
</ul>
|
|
</nav>
|
|
</header>
|
|
<main>
|
|
--fcc-editable-region--
|
|
<form method="post" action="https://freecodecamp.org/practice-project/accessibility-quiz">
|
|
<section role="region"></section>
|
|
<section role="region"></section>
|
|
<section role="region"></section>
|
|
</form>
|
|
--fcc-editable-region--
|
|
</main>
|
|
</body>
|
|
</html>
|
|
|
|
```
|
|
|
|
```css
|
|
body {
|
|
background: #f5f6f7;
|
|
color: #1b1b32;
|
|
font-family: Helvetica;
|
|
margin: 0;
|
|
}
|
|
|
|
header {
|
|
width: 100%;
|
|
height: 50px;
|
|
background-color: #1b1b32;
|
|
display: flex;
|
|
}
|
|
|
|
#logo {
|
|
width: max(100px, 18vw);
|
|
background-color: #0a0a23;
|
|
aspect-ratio: 35 / 4;
|
|
padding: 0.4rem;
|
|
}
|
|
|
|
h1 {
|
|
color: #f1be32;
|
|
font-size: min(5vw, 1.2em);
|
|
}
|
|
|
|
nav {
|
|
width: 50%;
|
|
max-width: 300px;
|
|
height: 50px;
|
|
}
|
|
|
|
nav > ul {
|
|
display: flex;
|
|
justify-content: space-evenly;
|
|
}
|
|
```
|