117 lines
3.1 KiB
Markdown
117 lines
3.1 KiB
Markdown
![]() |
---
|
||
|
id: 587d7788367417b2b2512aa3
|
||
|
title: 使用 footer 元素來讓屏幕閱讀器更容易進行導航
|
||
|
challengeType: 0
|
||
|
videoUrl: 'https://scrimba.com/c/crVrDh8'
|
||
|
forumTopicId: 301022
|
||
|
dashedName: make-screen-reader-navigation-easier-with-the-footer-landmark
|
||
|
---
|
||
|
|
||
|
# --description--
|
||
|
|
||
|
與 `header` 和 `nav` 類似,`footer` 元素也具有語義化的特性,可以讓輔助工具快速定位到它。 它位於頁面底部,用於呈現版權信息或者相關文檔鏈接。
|
||
|
|
||
|
# --instructions--
|
||
|
|
||
|
Camper Cat 的忍者訓練頁面進展順利。 請將他在頁面底部呈現版權信息的 `div` 元素更改爲 `footer` 元素。
|
||
|
|
||
|
# --hints--
|
||
|
|
||
|
應存在一個 `footer` 標籤。
|
||
|
|
||
|
```js
|
||
|
assert($('footer').length == 1);
|
||
|
```
|
||
|
|
||
|
不應存在 `div` 標籤。
|
||
|
|
||
|
```js
|
||
|
assert($('div').length == 0);
|
||
|
```
|
||
|
|
||
|
確保 `footer` 元素有結束標籤。
|
||
|
|
||
|
```js
|
||
|
assert(code.match(/<footer>\s*© 2018 Camper Cat\s*<\/footer>/g));
|
||
|
```
|
||
|
|
||
|
# --seed--
|
||
|
|
||
|
## --seed-contents--
|
||
|
|
||
|
```html
|
||
|
<body>
|
||
|
<header>
|
||
|
<h1>Training</h1>
|
||
|
<nav>
|
||
|
<ul>
|
||
|
<li><a href="#stealth">Stealth & Agility</a></li>
|
||
|
<li><a href="#combat">Combat</a></li>
|
||
|
<li><a href="#weapons">Weapons</a></li>
|
||
|
</ul>
|
||
|
</nav>
|
||
|
</header>
|
||
|
<main>
|
||
|
<section id="stealth">
|
||
|
<h2>Stealth & Agility Training</h2>
|
||
|
<article><h3>Climb foliage quickly using a minimum spanning tree approach</h3></article>
|
||
|
<article><h3>No training is NP-complete without parkour</h3></article>
|
||
|
</section>
|
||
|
<section id="combat">
|
||
|
<h2>Combat Training</h2>
|
||
|
<article><h3>Dispatch multiple enemies with multithreaded tactics</h3></article>
|
||
|
<article><h3>Goodbye world: 5 proven ways to knock out an opponent</h3></article>
|
||
|
</section>
|
||
|
<section id="weapons">
|
||
|
<h2>Weapons Training</h2>
|
||
|
<article><h3>Swords: the best tool to literally divide and conquer</h3></article>
|
||
|
<article><h3>Breadth-first or depth-first in multi-weapon training?</h3></article>
|
||
|
</section>
|
||
|
</main>
|
||
|
|
||
|
|
||
|
<div>© 2018 Camper Cat</div>
|
||
|
|
||
|
|
||
|
</body>
|
||
|
```
|
||
|
|
||
|
# --solutions--
|
||
|
|
||
|
```html
|
||
|
<body>
|
||
|
<header>
|
||
|
<h1>Training</h1>
|
||
|
<nav>
|
||
|
<ul>
|
||
|
<li><a href="#stealth">Stealth & Agility</a></li>
|
||
|
<li><a href="#combat">Combat</a></li>
|
||
|
<li><a href="#weapons">Weapons</a></li>
|
||
|
</ul>
|
||
|
</nav>
|
||
|
</header>
|
||
|
<main>
|
||
|
<section id="stealth">
|
||
|
<h2>Stealth & Agility Training</h2>
|
||
|
<article><h3>Climb foliage quickly using a minimum spanning tree approach</h3></article>
|
||
|
<article><h3>No training is NP-complete without parkour</h3></article>
|
||
|
</section>
|
||
|
<section id="combat">
|
||
|
<h2>Combat Training</h2>
|
||
|
<article><h3>Dispatch multiple enemies with multithreaded tactics</h3></article>
|
||
|
<article><h3>Goodbye world: 5 proven ways to knock out an opponent</h3></article>
|
||
|
</section>
|
||
|
<section id="weapons">
|
||
|
<h2>Weapons Training</h2>
|
||
|
<article><h3>Swords: the best tool to literally divide and conquer</h3></article>
|
||
|
<article><h3>Breadth-first or depth-first in multi-weapon training?</h3></article>
|
||
|
</section>
|
||
|
</main>
|
||
|
|
||
|
|
||
|
<footer>© 2018 Camper Cat</footer>
|
||
|
|
||
|
|
||
|
</body>
|
||
|
```
|