diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/add-a-text-alternative-to-images-for-visually-impaired-accessibility.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/add-a-text-alternative-to-images-for-visually-impaired-accessibility.md index 07ce65c072..dd1b18d5e4 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/add-a-text-alternative-to-images-for-visually-impaired-accessibility.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/add-a-text-alternative-to-images-for-visually-impaired-accessibility.md @@ -1,59 +1,32 @@ --- id: 587d774c367417b2b2512a9c +title: 为视觉障碍用户添加替代图像的文本 challengeType: 0 videoUrl: 'https://scrimba.com/c/cPp7VfD' forumTopicId: 16628 -title: 为视觉障碍用户添加替代图像的文本 --- -## Description -
-在其他挑战里你应该已经见到过img标签的alt属性了。alt属性中的文本作为备用文字描述了图片的内容,这可以帮助用户在图片加载失败或者不可见的情况下理解图片内容,也有助于搜索引擎理解图片内容,并将其加入到搜索结果中。例如: -<img src="importantLogo.jpeg" alt="Company logo"> -视觉障碍用户无法通过视觉获取信息,而是通过屏幕阅读器将网页内容转换为音频以获取信息。屏幕阅读器可以识别alt属性,朗读其中的内容,来告知用户图片包含的关键信息。 -良好的alt文本可以简明扼要地描述图片信息,所以你应该为图片添加alt属性。另外,HTML5 标准也在考虑强制要求对图片添加alt属性。 -
+# --description-- -## Instructions -
+在其他挑战里你应该已经见到过`img`标签的`alt`属性了。`alt`属性中的文本作为备用文字描述了图片的内容,这可以帮助用户在图片加载失败或者不可见的情况下理解图片内容,也有助于搜索引擎理解图片内容,并将其加入到搜索结果中。例如: -碰巧,Camper Cat 是忍者中写代码最厉害的,他正在建立一个可以分享忍者知识的网站。在这个网站中,他使用一张简介图片来展示技能。给img标签添加一个alt属性,说明 Camper Cat 在学习空手道(图片的src属性没有指向任何链接,因此你可以看到alt属性中的文本)。 +`Company logo` -
+视觉障碍用户无法通过视觉获取信息,而是通过屏幕阅读器将网页内容转换为音频以获取信息。屏幕阅读器可以识别`alt`属性,朗读其中的内容,来告知用户图片包含的关键信息。 -## Tests -
+良好的`alt`文本可以简明扼要地描述图片信息,所以你应该为图片添加`alt`属性。另外,HTML5 标准也在考虑强制要求对图片添加`alt`属性。 -```yml -tests: - - text: '你的img标签应该包含一个非空的alt属性。' - testString: assert($('img').attr('alt')); +# --instructions-- +碰巧,Camper Cat 是忍者中写代码最厉害的,他正在建立一个可以分享忍者知识的网站。在这个网站中,他使用一张简介图片来展示技能。给`img`标签添加一个`alt`属性,说明 Camper Cat 在学习空手道(图片的`src`属性没有指向任何链接,因此你可以看到`alt`属性中的文本)。 + +# --hints-- + +你的`img`标签应该包含一个非空的`alt`属性。 + +```js +assert($('img').attr('alt')); ``` -
+# --solutions-- -## Challenge Seed -
- -
- -```html - -``` - -
- - - -
- -## Solution -
- -```html -// solution required -``` - -
- \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/add-an-accessible-date-picker.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/add-an-accessible-date-picker.md index f68f7a2d9e..ece95bdbd6 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/add-an-accessible-date-picker.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/add-an-accessible-date-picker.md @@ -1,16 +1,19 @@ --- id: 587d778b367417b2b2512aa8 +title: 添加可访问的日期选择器 challengeType: 0 videoUrl: 'https://scrimba.com/c/cR3bRbCV' forumTopicId: 301008 -title: 添加可访问的日期选择器 --- -## Description -
-表单中经常出现input标签,它可以用来创建多种表单控件。它的type属性指定了所要创建的input标签类型。 -在以前的挑战中,你可能已经见过textsubmit类型的input标签,HTML5 引入了date类型来创建时间选择器。依赖于浏览器的支持,当点击input标签时,时间选择器会显示出来,这可以让用户填写表单更加容易。 -对于旧版本的浏览器,type属性的默认值是text。这种情况下,可以利用label标签或者占位文本来提示用户input标签的输入类型为日期。 +# --description-- + +表单中经常出现`input`标签,它可以用来创建多种表单控件。它的`type`属性指定了所要创建的`input`标签类型。 + +在以前的挑战中,你可能已经见过`text`与`submit`类型的`input`标签,HTML5 引入了`date`类型来创建时间选择器。依赖于浏览器的支持,当点击`input`标签时,时间选择器会显示出来,这可以让用户填写表单更加容易。 + +对于旧版本的浏览器,`type`属性的默认值是`text`。这种情况下,可以利用`label`标签或者占位文本来提示用户`input`标签的输入类型为日期。 + 举个例子: ```html @@ -18,74 +21,35 @@ title: 添加可访问的日期选择器 ``` -
+# --instructions-- -## Instructions -
-Camper Cat 想举办一场比武大会,他想收集参赛者的最佳参赛时间。请为 Camper Cat 的页面添加一个input标签,其type属性值为 date,id属性为 pickdate,name属性为 date。 -
+Camper Cat 想举办一场比武大会,他想收集参赛者的最佳参赛时间。请为 Camper Cat 的页面添加一个`input`标签,其`type`属性值为 date,`id`属性为 pickdate,`name`属性为 date。 -## Tests -
+# --hints-- -```yml -tests: - - text: '你的代码中应该有 1 个input标签。' - testString: assert($('input').length == 2); - - text: '你的input标签的type属性值应该为 date。' - testString: assert($('input').attr('type') == 'date'); - - text: '你的input标签的id属性值应该为 pickdate。' - testString: assert($('input').attr('id') == 'pickdate'); - - text: '你的input标签的name属性值应该为 date。' - testString: assert($('input').attr('name') == 'date'); +你的代码中应该有 1 个`input`标签。 +```js +assert($('input').length == 2); ``` -
+你的`input`标签的`type`属性值应该为 date。 -## Challenge Seed -
- -
- -```html - -
-

Tournaments

-
-
-
-

Mortal Kombat Tournament Survey

-
-

Tell us the best date for the competition

- - - - - - - - - -
-
-
- - +```js +assert($('input').attr('type') == 'date'); ``` -
+你的`input`标签的`id`属性值应该为 pickdate。 - - -
- -## Solution -
- -```html -// solution required +```js +assert($('input').attr('id') == 'pickdate'); ``` -
- \ No newline at end of file +你的`input`标签的`name`属性值应该为 date。 + +```js +assert($('input').attr('name') == 'date'); +``` + +# --solutions-- + diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-carefully-choosing-colors-that-convey-information.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-carefully-choosing-colors-that-convey-information.md index 64f666cfee..37fb643022 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-carefully-choosing-colors-that-convey-information.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-carefully-choosing-colors-that-convey-information.md @@ -1,71 +1,31 @@ --- id: 587d778f367417b2b2512aad +title: 考虑色盲用户的需求仔细选择传达信息的颜色 challengeType: 0 videoUrl: 'https://scrimba.com/c/c437as3' forumTopicId: 301011 -title: 考虑色盲用户的需求仔细选择传达信息的颜色 --- -## Description -
+# --description-- + 色盲的形式有很多种,它的表现可以从对特定波长光波的感知度较低,到几乎无法看到颜色。最常见的形式是对绿色的低感知度。 + 例如:如果内容的前景色与背景色是两种相近的绿色,那么色盲用户可能会无法识别它们。可以认为色轮上相邻的颜色是相近的,在表示重要信息的时候应避免使用这些颜色的组合。 -注意:
一些在线颜色拾取器有色盲模拟功能,可以模拟颜色在不同形式色盲的视觉中的呈现结果,它们和在线对比度检查器一样,都是很好的工具。 -
-## Instructions -
-Camper Cat 正在测试一个重要按钮的不同样式。在色轮上,黄色(#FFFF33)的background-color和绿色(#33FF33)的文本color是相邻的色调,一些色盲用户几乎无法区分它们,而且这两个颜色的亮度相近,对比度太小。为了解决这两个问题,请将文本的color修改为深蓝色(#003366)。 -
+**注意:** +一些在线颜色拾取器有色盲模拟功能,可以模拟颜色在不同形式色盲的视觉中的呈现结果,它们和在线对比度检查器一样,都是很好的工具。 -## Tests -
+# --instructions-- -```yml -tests: - - text: 'button的文本color应该是深蓝色。' - testString: assert($('button').css('color') == 'rgb(0, 51, 102)'); +Camper Cat 正在测试一个重要按钮的不同样式。在色轮上,黄色(`#FFFF33`)的`background-color`和绿色(`#33FF33`)的文本`color`是相邻的色调,一些色盲用户几乎无法区分它们,而且这两个颜色的亮度相近,对比度太小。为了解决这两个问题,请将文本的`color`修改为深蓝色(`#003366`)。 +# --hints-- + +`button`的文本`color`应该是深蓝色。 + +```js +assert($('button').css('color') == 'rgb(0, 51, 102)'); ``` -
+# --solutions-- -## Challenge Seed -
- -
- -```html - - - - -
-

Danger!

-
- - -``` - -
- - - -
- -## Solution -
- -```html -// solution required -``` - -
- \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-using-sufficient-contrast.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-using-sufficient-contrast.md index cebfe4060e..a4488b9cba 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-using-sufficient-contrast.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-using-sufficient-contrast.md @@ -1,76 +1,38 @@ --- id: 587d778f367417b2b2512aac +title: 考虑色盲用户的需求设置合适的对比度 challengeType: 0 videoUrl: 'https://scrimba.com/c/cmzMEUw' forumTopicId: 301012 -title: 考虑色盲用户的需求设置合适的对比度 --- -## Description -
+# --description-- + 颜色是可视化设计的重要组成部分,但是使用颜色也引入了两个可访问性问题。首先,不能仅仅使用颜色作为传达重要信息的唯一方式,因为屏幕阅读器无法获取这些信息。其次,前景色与背景色需要有足够的对比度,这样色盲用户才可以识别它们。 + 在之前的挑战中,我们用文本备用方案解决了第一个问题。在上一个挑战中,我们使用对比度检测工具解决了第二问题。WCAG 建议为颜色及灰度组合使用 4.5 : 1 的对比度。 + 色盲用户无法将一些颜色与另一些颜色区分出来——通常是因为色调,也有时候是因为亮度。你可能想起对比度是用前景色与背景色的相对亮度计算的。 + 实践中,在对比度检测工具的帮助下,我们可以通过将较暗的颜色变暗、将较淡的颜色变淡的方法来使对比度达到 4.5 : 1。在色轮中,较暗的颜色通常是蓝色、紫色、洋红和红色,而较淡的颜色通常是橙色、黄色、绿色和蓝绿色。 -
-## Instructions -
-Camper Cat 正在尝试为他的博客文本与背景使用颜色,但是他目前使用的组合是绿色的background-color与栗色的color,它们的对比度为 2.5 : 1。Camper Cat 使用了 CSS 的hsl()(hsl 为 hue, saturation, lightness 的缩写)属性来设置颜色,所以通过修改hsl()属性的第三个参数,可以很容易地调整颜色的亮度。请将background-color的亮度从 35% 增加到 55%,color的亮度从 20% 减少到 15%,这样可以使对比度达到 5.9 : 1。 -
+# --instructions-- -## Tests -
+Camper Cat 正在尝试为他的博客文本与背景使用颜色,但是他目前使用的组合是绿色的`background-color`与栗色的`color`,它们的对比度为 2.5 : 1。Camper Cat 使用了 CSS 的`hsl()`(hsl 为 hue, saturation, lightness 的缩写)属性来设置颜色,所以通过修改`hsl()`属性的第三个参数,可以很容易地调整颜色的亮度。请将`background-color`的亮度从 35% 增加到 55%,`color`的亮度从 20% 减少到 15%,这样可以使对比度达到 5.9 : 1。 -```yml -tests: - - text: '你应该将color属性的亮度值设置为 15%。' - testString: assert(code.match(/color:\s*?hsl\(0,\s*?55%,\s*?15%\)/gi)); - - text: '你应该将background-color属性的亮度值设置为 55%。' - testString: assert(code.match(/background-color:\s*?hsl\(120,\s*?25%,\s*?55%\)/gi)); +# --hints-- +你应该将`color`属性的亮度值设置为 15%。 + +```js +assert(code.match(/color:\s*?hsl\(0,\s*?55%,\s*?15%\)/gi)); ``` -
+你应该将`background-color`属性的亮度值设置为 55%。 -## Challenge Seed -
- -
- -```html - - - - -
-

Deep Thoughts with Master Camper Cat

-
-
-

A Word on the Recent Catnip Doping Scandal

-

The influence that catnip has on feline behavior is well-documented, and its use as an herbal supplement in competitive ninja circles remains controversial. Once again, the debate to ban the substance is brought to the public's attention after the high-profile win of Kittytron, a long-time proponent and user of the green stuff, at the Claw of Fury tournament.

-

As I've stated in the past, I firmly believe a true ninja's skills must come from within, with no external influences. My own catnip use shall continue as purely recreational.

-
- +```js +assert(code.match(/background-color:\s*?hsl\(120,\s*?25%,\s*?55%\)/gi)); ``` -
+# --solutions-- - - -
- -## Solution -
- -```html -// solution required -``` - -
- \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/give-links-meaning-by-using-descriptive-link-text.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/give-links-meaning-by-using-descriptive-link-text.md index e2fed1fc2b..92ca67f582 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/give-links-meaning-by-using-descriptive-link-text.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/give-links-meaning-by-using-descriptive-link-text.md @@ -1,67 +1,47 @@ --- id: 587d778f367417b2b2512aae +title: 使用描述性链接文本赋予链接含义 challengeType: 0 videoUrl: 'https://scrimba.com/c/c437DcV' forumTopicId: 301013 -title: 使用描述性链接文本赋予链接含义 --- -## Description -
+# --description-- + 屏幕阅读器用户可以选择其设备读取的内容的类型,这包括跳转到(或跳过)标志标签,跳转到主要内容,或者从标题中获取页面摘要,还可以选择只听取页面中的有效链接。 -屏幕阅读器通过阅读链接文本或者锚点标签(a)之间的内容来完成这个操作。使用 "click here" 或者 "read more" 作为链接文本并没有多少帮助。相反地,应该在a标签中使用简洁的描述性语言来为用户提供更多的信息。 -
-## Instructions -
-Camper Cat 在链接中使用的文本在脱离上下文的情况下,描述性不是很好。请修改锚点标签(a),将其包含的文本从 "click here" 改为 "information about batteries"。 -
+屏幕阅读器通过阅读链接文本或者锚点标签(`a`)之间的内容来完成这个操作。使用 "click here" 或者 "read more" 作为链接文本并没有多少帮助。相反地,应该在`a`标签中使用简洁的描述性语言来为用户提供更多的信息。 -## Tests -
+# --instructions-- -```yml -tests: - - text: '请修改a标签,将其包含的文本从 "click here" 改为 "information about batteries"。' - testString: assert($('a').text().match(/^(information about batteries)$/g)); - - text: 'a元素应该有一个href属性,且值为空字符串' - testString: assert($('a').attr('href') === ''); - - text: 'a 元素应该有一个结束标记' - testString: assert(code.match(/<\/a>/g) && code.match(/<\/a>/g).length === code.match(//g).length); +Camper Cat 在链接中使用的文本在脱离上下文的情况下,描述性不是很好。请修改锚点标签(`a`),将其包含的文本从 "click here" 改为 "information about batteries"。 +# --hints-- + +请修改`a`标签,将其包含的文本从 "click here" 改为 "information about batteries"。 + +```js +assert( + $('a') + .text() + .match(/^(information about batteries)$/g) +); ``` -
+`a`元素应该有一个`href`属性,且值为空字符串 -## Challenge Seed -
- -
- -```html - -
-

Deep Thoughts with Master Camper Cat

-
-
- +```js +assert($('a').attr('href') === ''); ``` -
+`a` 元素应该有一个结束标记 - - -
- -## Solution -
- -```html -// solution required +```js +assert( + code.match(/<\/a>/g) && + code.match(/<\/a>/g).length === code.match(//g).length +); ``` -
- \ No newline at end of file +# --solutions-- + diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-accessibility-of-audio-content-with-the-audio-element.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-accessibility-of-audio-content-with-the-audio-element.md index 4c37566ccd..bfbb615662 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-accessibility-of-audio-content-with-the-audio-element.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-accessibility-of-audio-content-with-the-audio-element.md @@ -1,15 +1,17 @@ --- id: 587d7789367417b2b2512aa4 +title: 使用 audio 元素提高音频内容的可访问性 challengeType: 0 videoUrl: 'https://scrimba.com/c/cVJVkcZ' forumTopicId: 301014 -title: 使用 audio 元素提高音频内容的可访问性 --- -## Description -
-HTML5 的audio标签用于呈现音频内容,它也具有语义化特性。可以在audio上下文中为音频内容添加文字说明或者字幕链接,使听觉障碍用户也能获取音频中的信息。 -audio支持controls属性,可以使浏览器为音频提供具有开始、暂停等功能的播放控件。controls属性是一个布尔属性,只要这个属性出现在audio标签中,浏览器就会开启播放控件。 +# --description-- + +HTML5 的`audio`标签用于呈现音频内容,它也具有语义化特性。可以在`audio`上下文中为音频内容添加文字说明或者字幕链接,使听觉障碍用户也能获取音频中的信息。 + +`audio`支持`controls`属性,可以使浏览器为音频提供具有开始、暂停等功能的播放控件。`controls`属性是一个布尔属性,只要这个属性出现在`audio`标签中,浏览器就会开启播放控件。 + 举个例子: ```html @@ -19,70 +21,65 @@ HTML5 的audio标签用于呈现音频内容,它也具有语义 ``` -注意:
多媒体内容通常同时包含音频与视频部分,它需要同步音频与字幕,以使视觉或听觉障碍用户可以获取它的内容。一般情况下,网页开发者不需要创建音频与字幕,但是需要将它们添加到多媒体中。 -
+**注意:** +多媒体内容通常同时包含音频与视频部分,它需要同步音频与字幕,以使视觉或听觉障碍用户可以获取它的内容。一般情况下,网页开发者不需要创建音频与字幕,但是需要将它们添加到多媒体中。 -## Instructions -
-是时候让 Camper Cat 休息一下,并与朋友 camper Zersiax (@zersiax) 会面。Zersiax 是一位屏幕阅读器用户,同时也是无障碍设计的高手。为了体验 Zersiax 的屏幕阅读器的朗读效果,请在p标签之后添加一个具有controls属性的audio标签。然后在audio标签内添加一个source标签,并且设置src属性为"https://s3.amazonaws.com/freecodecamp/screen-reader.mp3",并且设置type属性为"audio/mpeg". -注意:
音频片段的播放速度可能会快到另我们难以理解,但是对于屏幕阅读器用户来说这是正常速度。 -
+# --instructions-- -## Tests -
+是时候让 Camper Cat 休息一下,并与朋友 camper Zersiax (@zersiax) 会面。Zersiax 是一位屏幕阅读器用户,同时也是无障碍设计的高手。为了体验 Zersiax 的屏幕阅读器的朗读效果,请在`p`标签之后添加一个具有`controls`属性的`audio`标签。然后在`audio`标签内添加一个`source`标签,并且设置`src`属性为"`https://s3.amazonaws.com/freecodecamp/screen-reader.mp3`",并且设置`type`属性为"audio/mpeg". -```yml -tests: - - text: '你的代码应该包含一个audio标签。' - testString: assert($('audio').length === 1); - - text: '确保你的audio标签是闭合的。' - testString: assert(code.match(/<\/audio>/g).length === 1 && code.match(/[\s\S]*<\/audio>/g)); - - text: 'audio标签应具有controls属性。' - testString: assert($('audio').attr('controls')); - - text: '你的代码应具有source标签。' - testString: assert($('source').length === 1); - - text: 'source标签应该在audio标签中。' - testString: assert($('audio').children('source').length === 1); - - text: 'source标签中src属性的值应该与教程中的链接一致。' - testString: assert($('source').attr('src') === 'https://s3.amazonaws.com/freecodecamp/screen-reader.mp3'); - - text: 'source标签中应具有type属性,其值为 audio/mpeg。' - testString: assert($('source').attr('type') === 'audio/mpeg'); +**注意:** +音频片段的播放速度可能会快到另我们难以理解,但是对于屏幕阅读器用户来说这是正常速度。 +# --hints-- + +你的代码应该包含一个`audio`标签。 + +```js +assert($('audio').length === 1); ``` -
+确保你的`audio`标签是闭合的。 -## Challenge Seed -
- -
- -```html - -
-

Real Coding Ninjas

-
-
-

A sound clip of Zersiax's screen reader in action.

- - - -
- +```js +assert( + code.match(/<\/audio>/g).length === 1 && + code.match(/[\s\S]*<\/audio>/g) +); ``` -
+`audio`标签应具有`controls`属性。 - - -
- -## Solution -
- -```html -// solution required +```js +assert($('audio').attr('controls')); ``` -
- \ No newline at end of file +你的代码应具有`source`标签。 + +```js +assert($('source').length === 1); +``` + +`source`标签应该在`audio`标签中。 + +```js +assert($('audio').children('source').length === 1); +``` + +`source`标签中`src`属性的值应该与教程中的链接一致。 + +```js +assert( + $('source').attr('src') === + 'https://s3.amazonaws.com/freecodecamp/screen-reader.mp3' +); +``` + +`source`标签中应具有`type`属性,其值为 audio/mpeg。 + +```js +assert($('source').attr('type') === 'audio/mpeg'); +``` + +# --solutions-- + diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-chart-accessibility-with-the-figure-element.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-chart-accessibility-with-the-figure-element.md index 8a39a4fd06..3b5a4ab8b9 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-chart-accessibility-with-the-figure-element.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-chart-accessibility-with-the-figure-element.md @@ -1,16 +1,18 @@ --- id: 587d778a367417b2b2512aa5 +title: 使用 figure 元素提高图表的可访问性 challengeType: 0 videoUrl: 'https://scrimba.com/c/cGJMqtE' forumTopicId: 301015 -title: 使用 figure 元素提高图表的可访问性 --- -## Description -
-HTML5 引入了figure标签以及与之相关的figcaption标签。它们一起用于展示可视化信息(如:图片、图表)及其标题。这样通过语义化对内容进行分组并配以用于解释figure的文字,可以极大地提升内容的可访问性。 +# --description-- + +HTML5 引入了`figure`标签以及与之相关的`figcaption`标签。它们一起用于展示可视化信息(如:图片、图表)及其标题。这样通过语义化对内容进行分组并配以用于解释`figure`的文字,可以极大地提升内容的可访问性。 + 对于图表之类的可视化数据,标题可以为屏幕阅读器用户提供简要的说明。但是这里有一个难点,如何处理那些超出屏幕可视范围(使用 CSS)的表格版本的图表数据,以使屏幕阅读器用户也可以获取信息。 -举个例子——注意figcaption包含在figure标签中,并且可以与其他标签组合使用: + +举个例子——注意`figcaption`包含在`figure`标签中,并且可以与其他标签组合使用: ```html
@@ -22,96 +24,50 @@ HTML5 引入了figure标签以及与之相关的figcaption ``` -
+# --instructions-- -## Instructions -
-Camper Cat 正在努力创建一张条形图,用来显示每周用于隐形、战斗、武器训练的时间。请帮助完善他的页面,将他的用于呈现图表的div标签修改为figure标签,用于呈现图表标题的p标签改为figcaption标签。 -
+Camper Cat 正在努力创建一张条形图,用来显示每周用于隐形、战斗、武器训练的时间。请帮助完善他的页面,将他的用于呈现图表的`div`标签修改为`figure`标签,用于呈现图表标题的`p`标签改为`figcaption`标签。 -## Tests -
+# --hints-- -```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); +你的代码应该有 1 个`figure`标签。 +```js +assert($('figure').length == 1); ``` -
+你的代码应该有 1 个`figcaption`标签。 -## 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?

-
-
-
© 2018 Camper Cat
- +```js +assert($('figcaption').length == 1); ``` -
+你的代码不应有`div`标签。 - - -
- -## Solution -
- -```html -// solution required +```js +assert($('div').length == 0); ``` -
- \ No newline at end of file +你的代码不应有`p`标签。 + +```js +assert($('p').length == 0); +``` + +`figcaption`应该为`figure`的子标签。 + +```js +assert($('figure').children('figcaption').length == 1); +``` + +请确保你的`figure`标签是闭合的。 + +```js +assert( + code.match(/<\/figure>/g) && + code.match(/<\/figure>/g).length === code.match(/
/g).length +); +``` + +# --solutions-- + diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-form-field-accessibility-with-the-label-element.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-form-field-accessibility-with-the-label-element.md index 76a7c35875..303a638ae0 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-form-field-accessibility-with-the-label-element.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-form-field-accessibility-with-the-label-element.md @@ -1,17 +1,20 @@ --- id: 587d778a367417b2b2512aa6 +title: 使用 label 元素提高表单的可访问性 challengeType: 0 videoUrl: 'https://scrimba.com/c/cGJMMAN' forumTopicId: 301016 -title: 使用 label 元素提高表单的可访问性 --- -## Description -
+# --description-- + 合理地使用语义化的 HTML 标签和属性可以提升页面可访问性。在接下来的挑战中,你将会看到使用表单属性的重要场景。 -label标签用于呈现特定表单控件的文本,通常是选项的名称。这些文本代表了选项的含义,使表单具有更好的可读性。label标签的for属性指定了与label绑定的表单控件,并且屏幕阅读器也会读取for属性。 -在 HTML 基础章节的课程中,我们已经了解了单选按钮标签。在那节课程中,我们为了可以点击单选按钮的名称,将input标签放在label标签中。在本节课程中,我们介绍了另外一种实现这个功能的方法,那就是使用for属性。 -for属性的值必须与表单控件的id属性的值相同。举个例子: + +`label`标签用于呈现特定表单控件的文本,通常是选项的名称。这些文本代表了选项的含义,使表单具有更好的可读性。`label`标签的`for`属性指定了与`label`绑定的表单控件,并且屏幕阅读器也会读取`for`属性。 + +在 HTML 基础章节的课程中,我们已经了解了单选按钮标签。在那节课程中,我们为了可以点击单选按钮的名称,将`input`标签放在`label`标签中。在本节课程中,我们介绍了另外一种实现这个功能的方法,那就是使用`for`属性。 + +`for`属性的值必须与表单控件的`id`属性的值相同。举个例子: ```html
@@ -20,79 +23,23 @@ title: 使用 label 元素提高表单的可访问性
``` -
+# --instructions-- -## Instructions -
-Camper Cat 希望他的博客文章能有很多订阅,他想添加一个电子邮件注册表单。请为表示电子邮件的label标签添加for属性,并设置属性值与input标签的id属性值相同。 -
+Camper Cat 希望他的博客文章能有很多订阅,他想添加一个电子邮件注册表单。请为表示电子邮件的`label`标签添加`for`属性,并设置属性值与`input`标签的`id`属性值相同。 -## Tests -
+# --hints-- -```yml -tests: - - text: '你的label标签应该有 1 个非空的for属性。' - testString: assert($('label').attr('for')); - - text: 'for属性的值应该与input标签的 id 值 email 相同。' - testString: assert($('label').attr('for') == 'email'); +你的`label`标签应该有 1 个非空的`for`属性。 +```js +assert($('label').attr('for')); ``` -
+`for`属性的值应该与`input`标签的 id 值 email 相同。 -## Challenge Seed -
- -
- -```html - -
-

Deep Thoughts with Master Camper Cat

-
-
-
-

Sign up to receive Camper Cat's blog posts by email here!

- - - - - - - -
-
-
-

The Garfield Files: Lasagna as Training Fuel?

-

The internet is littered with varying opinions on nutritional paradigms, from catnip paleo to hairball cleanses. But let's turn our attention to an often overlooked fitness fuel, and examine the protein-carb-NOM trifecta that is lasagna...

-
- -
-

Defeating your Foe: the Red Dot is Ours!

-

Felines the world over have been waging war on the most persistent of foes. This red nemesis combines both cunning stealth and lightning speed. But chin up, fellow fighters, our time for victory may soon be near...

-
- -
-

Is Chuck Norris a Cat Person?

-

Chuck Norris is widely regarded as the premier martial artist on the planet, and it's a complete coincidence anyone who disagrees with this fact mysteriously disappears soon after. But the real question is, is he a cat person?...

-
-
© 2018 Camper Cat
- +```js +assert($('label').attr('for') == 'email'); ``` -
+# --solutions-- - - -
- -## Solution -
- -```html -// solution required -``` - -
- \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-readability-with-high-contrast-text.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-readability-with-high-contrast-text.md index 1db32ababd..025d7caa21 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-readability-with-high-contrast-text.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/improve-readability-with-high-contrast-text.md @@ -1,74 +1,34 @@ --- id: 587d778e367417b2b2512aab +title: 使用高对比度文本提高可读性 challengeType: 0 videoUrl: 'https://scrimba.com/c/cKb3nCq' forumTopicId: 301017 -title: 使用高对比度文本提高可读性 --- -## Description -
+# --description-- + 低对比度的前景色与背景色会使文本难以阅读。足够的对比度可以提高内容的可读性,但是怎样的对比度才算是 “足够” 的? + Web 内容无障碍指南(WCAG)建议正常文本的对比度至少为 4.5 : 1。对比度是通过比较两种颜色的相对亮度值来计算的,其范围是从相同颜色的 1 : 1(无对比度)到白色与黑色的最高对比度 21 : 1。网上有很多可以帮助你计算对比度的工具。 -
-## Instructions -
-Camper Cat 为他的博客选择了白色背景,浅灰色文字,对比度为 1.5 : 1,这使博客文章难以阅读。请将文字的color从当前的浅灰色(#D3D3D3)修改为深灰色(#636363),以使对比度提升到 6 : 1。 -
+# --instructions-- -## Tests -
+Camper Cat 为他的博客选择了白色背景,浅灰色文字,对比度为 1.5 : 1,这使博客文章难以阅读。请将文字的`color`从当前的浅灰色(`#D3D3D3`)修改为深灰色(`#636363`),以使对比度提升到 6 : 1。 -```yml -tests: - - text: '你应该将bodycolor修改为深灰色。' - testString: assert($('body').css('color') == 'rgb(99, 99, 99)'); - - text: '你不应该修改bodybackground-color。' - testString: assert($('body').css('background-color') == 'rgb(255, 255, 255)'); +# --hints-- +你应该将`body`的`color`修改为深灰色。 + +```js +assert($('body').css('color') == 'rgb(99, 99, 99)'); ``` -
+你不应该修改`body`的`background-color`。 -## Challenge Seed -
- -
- -```html - - - - -
-

Deep Thoughts with Master Camper Cat

-
-
-

A Word on the Recent Catnip Doping Scandal

-

The influence that catnip has on feline behavior is well-documented, and its use as an herbal supplement in competitive ninja circles remains controversial. Once again, the debate to ban the substance is brought to the public's attention after the high-profile win of Kittytron, a long-time proponent and user of the green stuff, at the Claw of Fury tournament.

-

As I've stated in the past, I firmly believe a true ninja's skills must come from within, with no external influences. My own catnip use shall continue as purely recreational.

-
- +```js +assert($('body').css('background-color') == 'rgb(255, 255, 255)'); ``` -
+# --solutions-- - - -
- -## Solution -
- -```html -// solution required -``` - -
- \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/jump-straight-to-the-content-using-the-main-element.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/jump-straight-to-the-content-using-the-main-element.md index 3d478536b7..aca630097c 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/jump-straight-to-the-content-using-the-main-element.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/jump-straight-to-the-content-using-the-main-element.md @@ -1,65 +1,38 @@ --- id: 587d774e367417b2b2512a9f +title: 使用 main 元素包裹主题内容 challengeType: 0 videoUrl: 'https://scrimba.com/c/cPp7zuE' forumTopicId: 301018 -title: 使用 main 元素包裹主题内容 --- -## Description -
-HTML5 添加了诸如mainheaderfooternavarticlesection等大量新标签,开发人员提供更多的选择,也兼顾了无障碍特性。 -默认情况下,浏览器呈现这些新标签的方式与div相似。然而,合理地使用它们,可以使你的标签更加的语义化。辅助技术(如:屏幕阅读器)可以通过这些标签为用户提供更加准确的、易于理解的页面信息。 -main标签用于呈现网页的主体内容,且每个页面只能有一个。这意味着它只应包含与页面中心主题相关的信息,而不应包含如导航连接、网页横幅等可以在多个页面中重复出现的内容。 -main标签的语义化特性可以使辅助技术快速定位到页面的主体。 如果页面顶部有一个 “跳转到主要内容” 的链接,那么辅助设备会自动识别main标签,实现这个功能。 -
+# --description-- -## Instructions -
-Camper Cat 对他的忍者武器页面有一些新的想法,请帮助他在header标签和footer标签(在接下来的挑战中会详细介绍)之间添加完整main标签来使页面语义化。在这个挑战中,你可以先让main为空。 -
+HTML5 添加了诸如`main`、`header`、`footer`、`nav`、`article`、`section`等大量新标签,开发人员提供更多的选择,也兼顾了无障碍特性。 -## Tests -
+默认情况下,浏览器呈现这些新标签的方式与`div`相似。然而,合理地使用它们,可以使你的标签更加的语义化。辅助技术(如:屏幕阅读器)可以通过这些标签为用户提供更加准确的、易于理解的页面信息。 -```yml -tests: - - text: '你的代码应该有一个main标签。' - testString: assert($('main').length == 1); - - text: 'main标签应该在header标签与footer标签之间。' - testString: assert(code.match(/<\/header>\s*?
\s*?<\/main>/gi)); +`main`标签用于呈现网页的主体内容,且每个页面只能有一个。这意味着它只应包含与页面中心主题相关的信息,而不应包含如导航连接、网页横幅等可以在多个页面中重复出现的内容。 +`main`标签的语义化特性可以使辅助技术快速定位到页面的主体。 如果页面顶部有一个 “跳转到主要内容” 的链接,那么辅助设备会自动识别`main`标签,实现这个功能。 + +# --instructions-- + +Camper Cat 对他的忍者武器页面有一些新的想法,请帮助他在`header`标签和`footer`标签(在接下来的挑战中会详细介绍)之间添加完整`main`标签来使页面语义化。在这个挑战中,你可以先让`main`为空。 + +# --hints-- + +你的代码应该有一个`main`标签。 + +```js +assert($('main').length == 1); ``` -
+`main`标签应该在`header`标签与`footer`标签之间。 -## Challenge Seed -
- -
- -```html -
-

Weapons of the Ninja

-
- - - -
+```js +assert(code.match(/<\/header>\s*?
\s*?<\/main>/gi)); ``` -
+# --solutions-- - - -
- -## Solution -
- -```html -// solution required -``` - -
- \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/know-when-alt-text-should-be-left-blank.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/know-when-alt-text-should-be-left-blank.md index 301f568dcc..7ef584f3c0 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/know-when-alt-text-should-be-left-blank.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/know-when-alt-text-should-be-left-blank.md @@ -1,71 +1,41 @@ --- id: 587d774c367417b2b2512a9d +title: 知道 Alt 文本何时应该留空 challengeType: 0 videoUrl: 'https://scrimba.com/c/cM9P4t2' forumTopicId: 301019 -title: 知道 Alt 文本何时应该留空 --- -## Description -
-在上一个挑战中,我们了解到img标签必须有一个alt属性。在图片已经有了文字说明,或者仅仅为了美化页面的情况下,alt属性似乎有些多余。 -即便如此,我们仍然需要为img标签添加alt属性,这时可以把它设为空,例如: -<img src="visualDecoration.jpeg" alt=""> +# --description-- + +在上一个挑战中,我们了解到`img`标签必须有一个`alt`属性。在图片已经有了文字说明,或者仅仅为了美化页面的情况下,`alt`属性似乎有些多余。 + +即便如此,我们仍然需要为`img`标签添加`alt`属性,这时可以把它设为空,例如: + +`` + 背景图片通常起装饰作用,而且含有 CSS 类,所以屏幕阅读器无法读取。 -注意:
对于有标题的图片,我们依然需要添加alt属性,因为这样有助于搜索引擎记录图片内容。 -
-## Instructions -
-Camper Cat 已经大体写好了博客页面。他打算使用忍者刀图片作为两篇文章之间的分割线,并为图片添加一个空的alt属性(注意:这里img标签的src属性提供的链接是无效的,因此页面上可能不会显示图片,不用担心)。 -
+**注意:** +对于有标题的图片,我们依然需要添加`alt`属性,因为这样有助于搜索引擎记录图片内容。 -## Tests -
+# --instructions-- -```yml -tests: - - text: '你的img标签应该包含alt属性。' - testString: assert(!($('img').attr('alt') == undefined)); - - text: 'alt属性对应的值应该为空。' - testString: assert($('img').attr('alt') == ''); +Camper Cat 已经大体写好了博客页面。他打算使用忍者刀图片作为两篇文章之间的分割线,并为图片添加一个空的`alt`属性(注意:这里`img`标签的`src`属性提供的链接是无效的,因此页面上可能不会显示图片,不用担心)。 +# --hints-- + +你的`img`标签应该包含`alt`属性。 + +```js +assert(!($('img').attr('alt') == undefined)); ``` -
+`alt`属性对应的值应该为空。 -## Challenge Seed -
- -
- -```html -

Deep Thoughts with Master Camper Cat

-
-

Defeating your Foe: the Red Dot is Ours!

-

To Come...

-
- - - -
-

Is Chuck Norris a Cat Person?

-

To Come...

-
+```js +assert($('img').attr('alt') == ''); ``` -
+# --solutions-- - - -
- -## Solution -
- -```html -// solution required -``` - -
- \ No newline at end of file diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-elements-only-visible-to-a-screen-reader-by-using-custom-css.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-elements-only-visible-to-a-screen-reader-by-using-custom-css.md index 6b3dc23ea9..816677ee84 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-elements-only-visible-to-a-screen-reader-by-using-custom-css.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-elements-only-visible-to-a-screen-reader-by-using-custom-css.md @@ -1,15 +1,17 @@ --- id: 587d778d367417b2b2512aaa +title: 使用自定义 CSS 让元素仅对屏幕阅读器可见 challengeType: 0 videoUrl: 'https://scrimba.com/c/cJ8QGkhJ' forumTopicId: 301020 -title: 使用自定义 CSS 让元素仅对屏幕阅读器可见 --- -## Description -
+# --description-- + 到目前为止,所有关于可访问性的挑战都没有使用 CSS。这是为了让你在关注外观样式之前,先把页面的逻辑结构写清,以及明确语义化标签的重要性。 + 然而,如果我们需要在页面中添加一些只对屏幕阅读器可见的内容时,CSS 可以提升页面的可访问性。当信息以可视化形式(如:图表)展示,而屏幕阅读器用户需要一种替代方式(如:表格)来获取信息时,就会出现这种情况。CSS 被用来将这些仅供屏幕阅读器使用的信息定位到浏览器可见区域之外。 + 举个例子: ```css @@ -23,140 +25,43 @@ title: 使用自定义 CSS 让元素仅对屏幕阅读器可见 } ``` -注意:
下面的 CSS 代码与上面的结果不同: +**注意:** +下面的 CSS 代码与上面的结果不同: +
  • display: none;visibility: hidden;会把内容彻底隐藏起来,对于屏幕阅读器也不例外。
  • 如果把值设置为 0px,如width: 0px; height: 0px;,意味着让元素脱离文档流,这样做也会让元素被屏幕阅读器忽略。
-
-## Instructions -
-Camper Cat 为他的训练页面创建了一个十分酷炫的条形图,并将数据放入表格中,供屏幕阅读器用户使用。表格已经有了一个sr-only类,但是还没有添加 CSS 规则。请设置position的值为 absolute,left 的值为 -10000px,widthheight的值为 1px。 -
+# --instructions-- -## Tests -
+Camper Cat 为他的训练页面创建了一个十分酷炫的条形图,并将数据放入表格中,供屏幕阅读器用户使用。表格已经有了一个`sr-only`类,但是还没有添加 CSS 规则。请设置`position`的值为 absolute,`left` 的值为 -10000px,`width`与`height`的值为 1px。 -```yml -tests: - - text: 'sr-only类中的position属性的值应为 absolute。' - testString: assert($('.sr-only').css('position') == 'absolute'); - - text: 'sr-only类中的left属性的值应为 -10000px。' - testString: assert($('.sr-only').css('left') == '-10000px'); - - text: 'sr-only类中的width属性的值应为 1px。' - testString: assert(code.match(/width:\s*?1px/gi)); - - text: 'sr-only类中的height属性的值应为 1px。' - testString: assert(code.match(/height:\s*?1px/gi)); +# --hints-- +`sr-only`类中的`position`属性的值应为 absolute。 + +```js +assert($('.sr-only').css('position') == 'absolute'); ``` -
+`sr-only`类中的`left`属性的值应为 -10000px。 -## Challenge Seed -
- -
- -```html - - - - -
-

Training

- -
-
-

Master Camper Cat's Beginner Three Week Training Program

-
- -

[Stacked bar chart]

-
-
Breakdown per week of time to spend training in stealth, combat, and weapons.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Hours of Weekly Training in Stealth, Combat, and Weapons
Stealth & AgilityCombatWeaponsTotal
Week One35210
Week Two45312
Week Three46313
-
-
-

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?

-
-
© 2018 Camper Cat
- +```js +assert($('.sr-only').css('left') == '-10000px'); ``` -
+`sr-only`类中的`width`属性的值应为 1px。 - - -
- -## Solution -
- -```html -// solution required +```js +assert(code.match(/width:\s*?1px/gi)); ``` -
- \ No newline at end of file +`sr-only`类中的`height`属性的值应为 1px。 + +```js +assert(code.match(/height:\s*?1px/gi)); +``` + +# --solutions-- + diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-links-navigable-with-html-access-keys.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-links-navigable-with-html-access-keys.md index 5ba19ecc28..b302ac4ff3 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-links-navigable-with-html-access-keys.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-links-navigable-with-html-access-keys.md @@ -1,84 +1,50 @@ --- id: 587d7790367417b2b2512aaf +title: 通过给元素添加 accesskey 属性来让用户可以在链接之间快速导航 challengeType: 0 videoUrl: 'https://scrimba.com/c/cQvmaTp' forumTopicId: 1 -title: 通过给元素添加 accesskey 属性来让用户可以在链接之间快速导航 --- -## Description -
-HTML 提供accesskey属性,用于指定激活标签或者使标签获得焦点的快捷键,这可以使键盘用户的导航更加便捷。 -HTML5 允许在任何标签上使用这个属性。该属性 (如链接、按钮、表单控件等)十分有用。 +# --description-- + +HTML 提供`accesskey`属性,用于指定激活标签或者使标签获得焦点的快捷键,这可以使键盘用户的导航更加便捷。 + +HTML5 允许在任何标签上使用这个属性。该属性 (如链接、按钮、表单控件等)十分有用。 + 举个例子: -<button accesskey="b">Important Button</button> -
-## Instructions -
-Camper Cat 希望为他的两篇博客的标题的链接设置快捷键,以使用户可以快速导航到文章的全文。请为这两个链接添加accesskey属性,并将第一个设置为 "g"(表示 Garfield),第二个设置为 "c"(表示 Chuck Norris)。 -
+`` -## Tests -
+# --instructions-- -```yml -tests: - - text: '你应该为id是 "first" 的a标签添加accesskey属性。' - testString: assert($('#first').attr('accesskey')); - - text: '你应该为id是 "second" 的a标签添加accesskey属性。' - testString: assert($('#second').attr('accesskey')); - - text: '你应该将id是 "first" 的a标签的accesskey属性值设置为小写 "g"。' - testString: assert($('#first').attr('accesskey') == 'g'); - - text: '你应该将id是 "second" 的a标签的accesskey属性值设置为小写 "c"。' - testString: assert($('#second').attr('accesskey') == 'c'); +Camper Cat 希望为他的两篇博客的标题的链接设置快捷键,以使用户可以快速导航到文章的全文。请为这两个链接添加`accesskey`属性,并将第一个设置为 "g"(表示 Garfield),第二个设置为 "c"(表示 Chuck Norris)。 +# --hints-- + +你应该为`id`是 "first" 的`a`标签添加`accesskey`属性。 + +```js +assert($('#first').attr('accesskey')); ``` -
+你应该为`id`是 "second" 的`a`标签添加`accesskey`属性。 -## Challenge Seed -
- -
- -```html - -
-

Deep Thoughts with Master Camper Cat

-
-
- - -

The Garfield Files: Lasagna as Training Fuel?

- - -

The internet is littered with varying opinions on nutritional paradigms, from catnip paleo to hairball cleanses. But let's turn our attention to an often overlooked fitness fuel, and examine the protein-carb-NOM trifecta that is lasagna...

-
-
- - -

Is Chuck Norris a Cat Person?

- - -

Chuck Norris is widely regarded as the premier martial artist on the planet, and it's a complete coincidence anyone who disagrees with this fact mysteriously disappears soon after. But the real question is, is he a cat person?...

-
-
© 2018 Camper Cat
- +```js +assert($('#second').attr('accesskey')); ``` -
+你应该将`id`是 "first" 的`a`标签的`accesskey`属性值设置为小写 "g"。 - - -
- -## Solution -
- -```html -// solution required +```js +assert($('#first').attr('accesskey') == 'g'); ``` -
- \ No newline at end of file +你应该将`id`是 "second" 的`a`标签的`accesskey`属性值设置为小写 "c"。 + +```js +assert($('#second').attr('accesskey') == 'c'); +``` + +# --solutions-- + diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-footer-landmark.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-footer-landmark.md index c2ef8b7011..88e065d000 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-footer-landmark.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-footer-landmark.md @@ -1,91 +1,38 @@ --- id: 587d7788367417b2b2512aa3 +title: 使用 footer 元素使屏幕阅读器更容易导航 challengeType: 0 videoUrl: 'https://scrimba.com/c/crVrDh8' forumTopicId: 301022 -title: 使用 footer 元素使屏幕阅读器更容易导航 --- -## Description -
-与headernav类似,footer也具有语义化特性,可以使辅助设备快速定位到它。它位于页面底部,用于呈现版权信息或者相关文档链接。 -
+# --description-- -## Instructions -
-Camper Cat 的忍者训练页面进展顺利。请将他在页面底部呈现版权信息的div标签更改为footer标签。 -
+与`header`和`nav`类似,`footer`也具有语义化特性,可以使辅助设备快速定位到它。它位于页面底部,用于呈现版权信息或者相关文档链接。 -## Tests -
+# --instructions-- -```yml -tests: - - text: '你的代码中应该包含 1 个footer标签。' - testString: assert($('footer').length == 1); - - text: '你的代码中不应包含div标签。' - testString: assert($('div').length == 0); - - text: '你代码中的footer应该是闭合的。' - testString: assert(code.match(/
\s*© 2018 Camper Cat\s*<\/footer>/g)); +Camper Cat 的忍者训练页面进展顺利。请将他在页面底部呈现版权信息的`div`标签更改为`footer`标签。 +# --hints-- + +你的代码中应该包含 1 个`footer`标签。 + +```js +assert($('footer').length == 1); ``` -
+你的代码中不应包含`div`标签。 -## Challenge Seed -
- -
- -```html - -
-

Training

- -
-
-
-

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?

-
-
- - -
© 2018 Camper Cat
- - - +```js +assert($('div').length == 0); ``` -
+你代码中的`footer`应该是闭合的。 - - -
- -## Solution -
- -```html -// solution required +```js +assert(code.match(/
\s*© 2018 Camper Cat\s*<\/footer>/g)); ``` -
- \ No newline at end of file +# --solutions-- + diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-header-landmark.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-header-landmark.md index 07760166af..44b20e8fd1 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-header-landmark.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-header-landmark.md @@ -1,86 +1,52 @@ --- id: 587d7787367417b2b2512aa1 +title: 使用 header 元素使屏幕阅读器更容易导航 challengeType: 0 videoUrl: 'https://scrimba.com/c/cB76vtv' forumTopicId: 301023 -title: 使用 header 元素使屏幕阅读器更容易导航 --- -## Description -
-header也是一个具有语义化的、提升页面可访问性的 HTML5 标签。它可以为父级标签呈现简介信息或者导航链接,适用于那些在多个页面顶部重复出现的内容。 -与main类似,header的语义化特性也可以使辅助技术快速定位到它的内容。 -注意:
header用在 HTML 文档的body标签中。这点与包含页面标题、元信息的head标签不同。 -
+# --description-- -## Instructions -
-Camper Cat 正在写一些训练忍者的精彩文章,并为它们建立一个新的页面。请使用header替换页面顶端包含h1div标签。 -
+`header`也是一个具有语义化的、提升页面可访问性的 HTML5 标签。它可以为父级标签呈现简介信息或者导航链接,适用于那些在多个页面顶部重复出现的内容。 -## Tests -
+与`main`类似,`header`的语义化特性也可以使辅助技术快速定位到它的内容。 -```yml -tests: - - text: '你的代码应该包含 1 个header标签。' - testString: assert($('header').length == 1); - - text: '你的header标签应该包含h1。' - testString: assert($('header').children('h1').length == 1); - - text: '你的代码不应有任何div标签。' - testString: assert($('div').length == 0); - - text: '确保你的header标签是闭合的。' - testString: assert(code.match(/<\/header>/g) && code.match(/<\/header>/g).length === code.match(/
/g).length); +**注意:** +`header`用在 HTML 文档的`body`标签中。这点与包含页面标题、元信息的`head`标签不同。 +# --instructions-- + +Camper Cat 正在写一些训练忍者的精彩文章,并为它们建立一个新的页面。请使用`header`替换页面顶端包含`h1`的`div`标签。 + +# --hints-- + +你的代码应该包含 1 个`header`标签。 + +```js +assert($('header').length == 1); ``` -
+你的`header`标签应该包含`h1`。 -## Challenge Seed -
- -
- -```html - - -
-

Training with Camper Cat

-
- - -
-
-

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?

-
-
- +```js +assert($('header').children('h1').length == 1); ``` -
+你的代码不应有任何`div`标签。 - - -
- -## Solution -
- -```html -// solution required +```js +assert($('div').length == 0); ``` -
- \ No newline at end of file +确保你的`header`标签是闭合的。 + +```js +assert( + code.match(/<\/header>/g) && + code.match(/<\/header>/g).length === code.match(/
/g).length +); +``` + +# --solutions-- + diff --git a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-nav-landmark.md b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-nav-landmark.md index f74f62f754..2805269310 100644 --- a/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-nav-landmark.md +++ b/curriculum/challenges/chinese/01-responsive-web-design/applied-accessibility/make-screen-reader-navigation-easier-with-the-nav-landmark.md @@ -1,91 +1,49 @@ --- id: 587d7788367417b2b2512aa2 +title: 使用 nav 元素使屏幕阅读器更容易导航 challengeType: 0 videoUrl: 'https://scrimba.com/c/czVwWSv' forumTopicId: 301024 -title: 使用 nav 元素使屏幕阅读器更容易导航 --- -## Description -
-nav也是一个具有语义化特性的 HTML5 标签,用于呈现页面中的主导航链接。它可以使屏幕阅读器快速识别页面中的导航信息。 -对于在多个页面底部出现的站点链接,不需要使用nav,用footer(在下个挑战中介绍)会更好。 -
+# --description-- -## Instructions -
-Camper Cat 在他的忍者训练页面顶端使用了很多导航链接,但把它们写在了div中。请将div更改为nav标签,以提升页面的可访问性。 -
+`nav`也是一个具有语义化特性的 HTML5 标签,用于呈现页面中的主导航链接。它可以使屏幕阅读器快速识别页面中的导航信息。 -## Tests -
+对于在多个页面底部出现的站点链接,不需要使用`nav`,用`footer`(在下个挑战中介绍)会更好。 -```yml -tests: - - text: '你的代码应该有 1 个nav标签。' - testString: assert($('nav').length == 1); - - text: '你的nav标签应该包含ul标签及其列表项。' - testString: assert($('nav').children('ul').length == 1); - - text: '你的代码不应包含div标签。' - testString: assert($('div').length == 0); - - text: '确保你的nav标签是闭合的。' - testString: assert(code.match(/<\/nav>/g) && code.match(/<\/nav>/g).length === code.match(/
+你的`nav`标签应该包含`ul`标签及其列表项。 -## Challenge Seed -
- -
- -```html - -
-

Training with Camper Cat

- - - -
-
-
-

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?

-
-
- +```js +assert($('nav').children('ul').length == 1); ``` -
+你的代码不应包含`div`标签。 - - -
- -## Solution -
- -```html -// solution required +```js +assert($('div').length == 0); ``` -
- \ No newline at end of file +确保你的`nav`标签是闭合的。 + +```js +assert( + code.match(/<\/nav>/g) && + code.match(/<\/nav>/g).length === code.match(/