--- id: 587d778a367417b2b2512aa5 challengeType: 0 videoUrl: 'https://scrimba.com/c/cGJMqtE' forumTopicId: 301015 title: 使用 figure 元素提高图表的可访问性 --- ## Description
HTML5 引入了figure标签以及与之相关的figcaption标签。它们一起用于展示可视化信息(如:图片、图表)及其标题。这样通过语义化对内容进行分组并配以用于解释figure的文字,可以极大地提升内容的可访问性。 对于图表之类的可视化数据,标题可以为屏幕阅读器用户提供简要的说明。但是这里有一个难点,如何处理那些超出屏幕可视范围(使用 CSS)的表格版本的图表数据,以使屏幕阅读器用户也可以获取信息。 举个例子——注意figcaption包含在figure标签中,并且可以与其他标签组合使用: ```html
Photo of Camper Cat executing a roundhouse kick
Master Camper Cat demonstrates proper form of a roundhouse kick.
```
## Instructions
Camper Cat 正在努力创建一张条形图,用来显示每周用于隐形、战斗、武器训练的时间。请帮助完善他的页面,将他的用于呈现图表的div标签修改为figure标签,用于呈现图表标题的p标签改为figcaption标签。
## Tests
```yml tests: - text: '你的代码应该有 1 个figure标签。' testString: assert($('figure').length == 1); - text: '你的代码应该有 1 个figcaption标签。' testString: assert($('figcaption').length == 1); - text: '你的代码不应有div标签。' testString: assert($('div').length == 0); - text: '你的代码不应有p标签。' testString: assert($('p').length == 0); - text: 'figcaption应该为figure的子标签。' testString: assert($('figure').children('figcaption').length == 1); - text: '请确保你的figure标签是闭合的。' testString: assert(code.match(/<\/figure>/g) && code.match(/<\/figure>/g).length === code.match(/
/g).length); ```
## Challenge Seed
```html

Training


Breakdown per week of time to spend training in stealth, combat, and weapons.

Stealth & Agility Training

Climb foliage quickly using a minimum spanning tree approach

No training is NP-complete without parkour

Combat Training

Dispatch multiple enemies with multithreaded tactics

Goodbye world: 5 proven ways to knock out an opponent

Weapons Training

Swords: the best tool to literally divide and conquer

Breadth-first or depth-first in multi-weapon training?

```
## Solution
```html // solution required ```